Problem/Motivation
The container does a strtolower() for every service name that's passed to it.
Proposed resolution
There's already an optimisation in there via an upstream PR I did to avoid this when the service has already been initialized, but I'm still seeing 190 calls to strtolower() that are completely useless. Just needs slight re-organisation of the code to avoid calling it at all.
This is not an exciting performance improvement - on my local we save about 0.5ms - but it will get worse the more container::get() calls there are for different services, and it's a free saving.
Before:
After:
Remaining tasks
Upstream PR.
API changes
Comment | File | Size | Author |
---|---|---|---|
#1 | Screen Shot 2015-04-30 at 4.48.18 PM.png | 190.59 KB | catch |
#1 | Screen Shot 2015-04-30 at 4.48.26 PM.png | 190.84 KB | catch |
#1 | 2480943_strtolower.patch | 4.15 KB | catch |
Comments
Comment #1
catchComment #2
catchComment #3
catchComment #4
Wim LeersComment #5
Crell CreditAttribution: Crell at Palantir.net commentedAre you suggesting we pass this upstream? Because patching stuff in vendor is a no-go, especially when there's still issues open to try and get that whole directory out of the repository (and therefore unpatchable).
Comment #6
catchYes I haven't done the upstream PR yet - was trying to find the original PR I did for strtolower() to reference it, but didn't find it yet.
Comment #7
catchHere it is: https://github.com/symfony/symfony/pull/14558
Comment #8
Wim LeersComment #9
joelpittetWas merged upstream, thanks @catch