Skip to content

[ObjectMapper] cache attributes in memory #61497

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: 7.3
Choose a base branch
from

Conversation

soyuka
Copy link
Contributor

@soyuka soyuka commented Aug 21, 2025

Q A
Branch? 7.3
Bug fix? yes
New feature? no
Deprecations? no
Issues na
License MIT

Profile:

20250821_22h15m27s_grim 20250821_22h15m12s_grim
phpbench ```php namespace Symfony\Component\ObjectMapper\Benchmarks;

use PhpBench\Attributes as Bench;
use Symfony\Component\ObjectMapper\ObjectMapper;
use Symfony\Component\ObjectMapper\Tests\Fixtures\A;
use Symfony\Component\ObjectMapper\Tests\Fixtures\C;
use Symfony\Component\ObjectMapper\Tests\Fixtures\D;

#[Bench\BeforeMethods('setUp')]
class ObjectMapperBench
{
private ObjectMapper $objectMapper;
private A $sourceObject;

public function setUp(): void
{
    $this->objectMapper = new ObjectMapper();

    $d = new D(baz: 'foo', bat: 'bar');
    $c = new C(foo: 'foo', bar: 'bar');
    $this->sourceObject = new A();
    $this->sourceObject->foo = 'test';
    $this->sourceObject->transform = 'test';
    $this->sourceObject->baz = 'me';
    $this->sourceObject->notinb = 'test';
    $this->sourceObject->relation = $c;
    $this->sourceObject->relationNotMapped = $d;
}

#[Bench\Revs(100)]
#[Bench\Iterations(5)]
public function benchObjectMapper(): void
{
    $this->objectMapper->map($this->sourceObject);
}

}

</details>

@OskarStark
Copy link
Contributor

The table in the PR header does not match our standards

@soyuka
Copy link
Contributor Author

soyuka commented Aug 22, 2025

The table in the PR header does not match our standards

I understood that as long as MIT was present this was ok, I removed the columns that are not relevant...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants