On 16/03/2021 14:21, Larry Garfield wrote:
1) As the stated reason for this RFC is performance, have you any benchmarks to show how much we'd win by using an engine-space lookup rather than user-space lookup?
Performance benefit is unfortunately quite small, my tests suggest it is in the region of 3 to 5% vs invoking a userland function an equivilent number of times and looking up in a classmap. It's ever so slightly higher if comparing against something doing a lowercase on each one.
If that's enough to justify it passing an RFC is left to the voters. The intent is for a free micro optimization at framework level that most users would never see.
3) The lower-casing of class names feels weird to me. Why? Given that most filesystems are case sensitive, that seems like an odd requirement and the RFC doesn't include an explanation of why that's beneficial.
The filesystem is case sensitive, but the class names are not, and are handled as lowercase at engine level. new Foo() is the same - new foo() as far as lookups.
Requiring lowercase names means that the lookup will perform the same regardless of which case is used in the code. Doing otherwise would require either an exact case match (which is not how PHP operates), or forcing the list to lowercase at the call to autoload_set_classmap, which would harm performance when it's perfectly reasonable to expect a static lowercase map to be given.
It is important to note that only the array key is lowercase, the value, the path name, IS case sensitive.
Mark Randall -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php