Re: [RFC] Autoloader Classmap

From: Date: Sat, 20 Mar 2021 01:59:41 +0000
Subject: Re: [RFC] Autoloader Classmap
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-113636@lists.php.net to get a copy of this message
> On Mar 19, 2021, at 2:40 PM, Mark Randall <marandall@php.net> wrote:
> 
> On 19/03/2021 14:45, Nikita Popov wrote:
>> Could you please update the RFC with some performance numbers, including
>> the used methodology? The number of 5% has been floating around, but it's
>> not clear what it refers to. I'm primarily interested in end-to-end effect,
>> e.g. on the symfony demo project.
> 
> I have updated the RFC with the following:
> 
> Testing suggests that autoloading through an internal classmap delivers around 5% performance
> increase vs a userland function call (e.g. composer).
> 
> This is 5% of the cost of the autoloading, and not the execution as a whole. Testing was
> performed by creating 50,000 empty classes each in an individual file, and then autoloading every
> one of them in a loop. Amount of classes was purely to help reduce noise.
> 
> Average for internal classmap was 0.295 vs 0.313 for spl_autoload_register representing 5.9%
> difference (in autoload performance only).
> 
> >>
> 
> I appreciate this is a small amount. If internals feels the additional code is not worth it for
> such a small gain, I have no issue at all with the RFC being rejected.

JMTCW, but I see a gain for this proposal that is more than just performance.  

- It allows use-cases that don't fit PSR-4 — like WordPress plugins — to opt-in to using a
core autoloader w/o having roll their own and end up with having tens or more registered
autoloaders.

- It could make XDEBUG debugging much less tedious by eliminating the drill-down into the autoloader
every time an unloaded class is referenced.

#fwiw

-Mike


Thread (26 messages)

« previous php.internals (#113636) next »