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

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

catch’s picture

catch’s picture

Issue summary: View changes
catch’s picture

Issue summary: View changes
Wim Leers’s picture

Crell’s picture

Are 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).

catch’s picture

Yes 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.

catch’s picture

Status: Needs review » Postponed
Wim Leers’s picture

Issue tags: +Needs upstream bugfix
joelpittet’s picture

Status: Postponed » Fixed

Was merged upstream, thanks @catch

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.