-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[Serializer] add array cache in front of serializer cache #35079
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
[Serializer] add array cache in front of serializer cache #35079
Conversation
ab -n 100
|
src/Symfony/Component/Serializer/Mapping/Factory/CacheClassMetadataFactory.php
Outdated
Show resolved
Hide resolved
519d26e
to
6ee306b
Compare
Should we implement the |
I'm not sure this would qualify as a leak: the memory requirement is asymptotic, ie it won't grow once all classes used by the app have been loaded. This is the same for eg opcache. |
@@ -32,6 +32,8 @@ class CacheClassMetadataFactory implements ClassMetadataFactoryInterface | |||
*/ | |||
private $cacheItemPool; | |||
|
|||
private $loadedClasses = []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name is misleading. It's actually an array of ClassMetadata
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I followed the name of the delegated class https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Serializer/Mapping/Factory/ClassMetadataFactory.php#L31
Thank you @bastnic. |
…e (bastnic) This PR was merged into the 5.1-dev branch. Discussion ---------- [Serializer] add array cache in front of serializer cache | Q | A | ------------- | --- | Branch? | master | Bug fix? | performance | New feature? | ... | Deprecations? | no | Tickets | #35041 | License | MIT | Doc PR | This is another implementation of #35041, after #35046. The DI solution is cleaner, but 10ms slower on my scenario (13 vs 3) and this data is not supposed to change at all (even in the original method there is a local cache). Diff from master (without warmup):  Diff form master (with warmup):  Diff from #35046:  Ping @nicolas-grekas Commits ------- 6ee306b [Cache] add array cache in front of serializer cache
This is another implementation of #35041, after #35046.
The DI solution is cleaner, but 10ms slower on my scenario (13 vs 3) and this data is not supposed to change at all (even in the original method there is a local cache).
Diff from master (without warmup):
Diff form master (with warmup):
Diff from #35046:
Ping @nicolas-grekas