-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[FrameworkBundle] Introduce a cache warmer for Validator based on PhpArrayAdapter #19485
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
Conversation
90616f5
to
3b05660
Compare
2586e76
to
94543a9
Compare
I think this is ready for reviews. |
7e9ce05
to
41a9e8f
Compare
private $fallbackPool; | ||
|
||
/** | ||
* @param array $bundles The application bundles to find validation metadata in. |
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.
out of sync
41a9e8f
to
00f9541
Compare
Updated |
00f9541
to
9092925
Compare
0d20399
to
c84db06
Compare
Added tests for the warmer. |
522a48a
to
5568b27
Compare
👍 |
5568b27
to
3a7b7f7
Compare
@tgalopin only have a question about performances. |
@mickaelandrieu I also said that the difference in terms of performance was negligible and that we shouldn't care. In fact, PhpArrayAdapter is faster than Doctrine (for what it means :) ). |
* | ||
* @author Titouan Galopin <galopintitouan@gmail.com> | ||
*/ | ||
class ValidatorCacheWarmer implements CacheWarmerInterface |
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.
This cache warmer is very similar to the one you proposed for the serializer, can't we create a new abstract class ?
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.
Even if it seems similar, there is only a few lines that can be shared. I don't think it's worth it.
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 think it can be used in third party libraries and promote cache warmers by making them much easier to use.
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.
Let's discuss about this in another PR: it's not directly related to this PR and would deserve a dedicated line in the changelog.
290db2c
to
4365d7c
Compare
4365d7c
to
6bdaf0b
Compare
…zer based on PhpArrayAdapter (tgalopin) This PR was merged into the 3.2-dev branch. Discussion ---------- [FrameworkBundle] Introduce a cache warmer for Serializer based on PhpArrayAdapter | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - Following the cache warmer for annotations (#18533) and for the validator (#19485), this PR introduces a cache warmer for the Serializer YAML and XML metadata configuration (mainly groups). Based on the PhpArrayAdapter, it uses the naming conventions (Resources/config/serialization) to find the files and compile them into a single PHP file stored in the cache directory. This file uses shared memory on PHP 7. The benefit of this PR are the same than the ones of the previous PR: - serialization metadata cache can be warmed up offline - on PHP 7, there is no need for user extension to get maximum performances (ie. if you use this PR and the other one, you probably won't need to enable APCu to have great performances) - on PHP 7 again, we are not sensitive to APCu memory fragmentation last but not least, global performance is slightly better (I get 30us per class gain in Blackfire) As previous work on the Serializer cache system introduced issues (see 96e418a), it would be interesting to pay careful attention to the backward compatibility during the review (ping @Ener-Getick). Commits ------- 810f469 [FrameworkBundle] Introduce a cache warmer for Serializer based on PhpArrayAdapter
Thank you @tgalopin. |
…or based on PhpArrayAdapter (tgalopin) This PR was merged into the 3.2-dev branch. Discussion ---------- [FrameworkBundle] Introduce a cache warmer for Validator based on PhpArrayAdapter | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | yes | Tests pass? | - | Fixed tickets | - | License | MIT | Doc PR | - Following the cache warmer for annotations PR (#18533), this PR introduces a cache warmer for YAML and XML Validator configuration. Based on the PhpArrayAdapter, it uses the naming conventions (`Resources/config/validation`) to find the files and compile them into a single PHP file stored in the cache directory. This file uses shared memory on PHP 7. The benefit of this PR are the same than the ones of the annotations PR: - validation configuration can be warmed up offline - on PHP 7, there is no need for user extension to get maximum performances (ie. if you use this PR and the other one, you probably won't need to enable APCu to have great performances) - on PHP 7 again, we are not sensitive to APCu memory fragmentation - last but not least, global performance is slightly better (I get 30us per class gain in Blackfire) This PR also deprecates the framework.validator.cache key in favor of the cache pool introduced in #18544. Commits ------- 6bdaf0b [FrameworkBundle] Introduce a cache warmer for Validator based on PhpArrayAdapter
Following the cache warmer for annotations PR (#18533), this PR introduces a cache warmer for YAML and XML Validator configuration.
Based on the PhpArrayAdapter, it uses the naming conventions (
Resources/config/validation
) to find the files and compile them into a single PHP file stored in the cache directory. This file uses shared memory on PHP 7.The benefit of this PR are the same than the ones of the annotations PR:
This PR also deprecates the framework.validator.cache key in favor of the cache pool introduced in #18544.