Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
fabpot merged 1 commit intosymfony:7.4fromsoyuka:perf-mapper
Aug 27, 2025

Conversation

@soyuka
Copy link
Contributor

@soyukasoyuka commentedAug 21, 2025
edited by GromNaN
Loading

QA
Branch?7.4
Bug fix?yes
New feature?no
Deprecations?no
Issuesna
LicenseMIT

Profile:

20250821_22h15m27s_grim20250821_22h15m12s_grim
phpbench```phpnamespace 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>

Spomky reacted with rocket emoji
@OskarStark
Copy link
Contributor

The table in the PR header does not match our standards

@soyuka
Copy link
ContributorAuthor

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...

Copy link
Contributor

@SpomkySpomky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

If the$reflectionClassCache keys are only strings, the SplObjectStorage is not needed right?
(because of$this->reflectionClassCache[$object::class] it will throw an exception)

Copy link
Contributor

@SpomkySpomky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Looks great!👍

Copy link
Member

@GromNaNGromNaN left a comment
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

That's a good iterative improvement. To get the best performance, this cache should be generated in the DIC cache and injected at instantiation.

@soyuka
Copy link
ContributorAuthor

@GromNaN probably that warming up#61515 would be even better :)

rvanlaak reacted with rocket emoji

@fabpot
Copy link
Member

fabpot commentedAug 27, 2025
edited
Loading

As this is a perf improvement, it cannot be considered as a bug and as such, it will be merged in 7.4.

@fabpotfabpot modified the milestones:7.3,7.4Aug 27, 2025
@fabpotfabpot changed the base branch from7.3 to7.4August 27, 2025 09:12
@fabpot
Copy link
Member

Thank you@soyuka.

@fabpotfabpot merged commit07273df intosymfony:7.4Aug 27, 2025
This was referencedOct 27, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas left review comments

@fabpotfabpotfabpot approved these changes

@GromNaNGromNaNGromNaN approved these changes

@SpomkySpomkySpomky approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

7.4

Development

Successfully merging this pull request may close these issues.

7 participants

@soyuka@OskarStark@fabpot@nicolas-grekas@GromNaN@Spomky@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp