Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[Serializer] Add local cache to normalizers#24228
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
Uh oh!
There was an error while loading.Please reload this page.
Conversation
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.
+ inlineSerializer::denormalizeObject()?
| publicfunctionsupportsNormalization($data,$format =null) | ||
| { | ||
| returnparent::supportsNormalization($data,$format) &&$this->supports(get_class($data)); | ||
| returnparent::supportsNormalization($data,$format) &&(isset($this->cache[$type =\get_class($data)]) ?$this->cache[$type] :$this->cache[$type] =$this->supports($type)); |
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.
applies to supportsDenormalization as well, no?
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.
what aboutprivate static $cache +private static supports() + inline isGetMethod
| publicfunctionsupportsNormalization($data,$format =null) | ||
| { | ||
| returnparent::supportsNormalization($data,$format) &&$this->supports(get_class($data)); | ||
| returnparent::supportsNormalization($data,$format) &&(isset($this->cache[$type =\get_class($data)]) ?$this->cache[$type] :$this->cache[$type] =$this->supports($type)); |
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.
same
nicolas-grekas commentedSep 16, 2017 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Done. |
| publicfunctionsupportsDenormalization($data,$type,$format =null/*, array $context = array()*/) | ||
| { | ||
| $context =func_num_args() >3 ?func_get_arg(3) :array(); | ||
| $context =\func_num_args() >3 ?func_get_arg(3) :array(); |
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.
0fdab2f to23f485eCompareogizanagi commentedSep 17, 2017
Won't it make sense to backport what could be on lower branches? |
nicolas-grekas commentedSep 18, 2017
AFAIK, we merge perf improvements as new feats usually (even if we diverged sometime from this rule, but we shouldn't anymore unless catastrophic. Not sure it's the case here?) |
…kas)This PR was merged into the 3.4 branch.Discussion----------[Serializer] Add local cache to normalizers| Q | A| ------------- | ---| Branch? | 3.4| Bug fix? | no| New feature? | no| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets |#24206| License | MIT| Doc PR | -Should help making the Serializer a bit faster.Commits-------b0c5cf0 [Serializer] Add local cache to normalizers
Uh oh!
There was an error while loading.Please reload this page.
Should help making the Serializer a bit faster.