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
Reuse the array key of mimetypes #13438
Conversation
This function is called a lot of times and was really slow before due to not reusing the same array. Previously when it was called 500'000 times it took about 2seconds, now we're down to 0.2 seconds on my local machine. Ref #13434
A new inspection was created. |
Refer to this link for build results (access rights to CI server needed): |
Metrics? But I can see why this is important, so 👍 |
Well, there is not much sense in a metric that shows exactly the same as my original comment says ;-) |
I uploaded my sample files collection that consists of many different file types. All mimetypes are fine there. So 👍 from my side. @DeepDiver1975 @karlitschek Low change of breaking stuff, but huge performance impact (as it even can be cached in PHPs OPCache ;)) I would rate for a merge into master before ownCloud 8 |
looks good 👍 |
@@ -28,6 +28,75 @@ class OC_Helper { | |||
private static $mimetypeIcons = array(); | |||
private static $mimetypeDetector; | |||
private static $templateManager; | |||
/** @var string[] */ | |||
private static $mimeTypeAlias = 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.
I'd really prefer to get this out of the helper class - but this is something for 8.1
👍 |
Reuse the array key of mimetypes
This function is called a lot of times and was really slow before due to not reusing the same array.
Previously when it was called 500'000 times it took about 2seconds, now we're down to 0.2 seconds on my local machine.
Ref #13434