-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
MimeTypeGuesser proxy. #27307
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
Comments
I am not sure I understand your issue. Why should your example behave differently at all? Isn't actually executed code still the same? |
In my workaround guess() (and passthru() internally) will be called only when Serializer serialize()/deserialize() executes. Without proxy it calls every time when serializer instantiated but never used. So, passthru() executes for all application requests, not only for api platform. |
You are right indeed. I wonder if we shouldn't make the core |
I don’t know the internals, but any improvement in performances of the serislized are welcomed for me! It is used heavily by ApiPlatform and everything that makes it Faster is good! |
…ialization (nicolas-grekas) This PR was merged into the 2.7 branch. Discussion ---------- [HttpFoundation] Fix perf issue during MimeTypeGuesser intialization | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #27307 | License | MIT | Doc PR | - introduced in #26886  Commits ------- f8e7a18 [HttpFoundation] Fix perf issue during MimeTypeGuesser intialization
Description
Serializer instantiation sometimes takes long time (30ms):
Simplest workaround for now is create proxy for MimeTypeGuesser.
Example
https://github.com/symfony/symfony/blob/v4.0.9/src/Symfony/Bundle/FrameworkBundle/Resources/config/serializer.xml#L33
https://github.com/symfony/symfony/blob/v4.0.9/src/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesser.php#L83
https://github.com/symfony/symfony/blob/v4.0.9/src/Symfony/Component/HttpFoundation/File/MimeType/FileBinaryMimeTypeGuesser.php#L57
The text was updated successfully, but these errors were encountered: