You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With some larger monolithic apps like Pimcore which include a lot of deps, autoload_static.php can grow so big it starts showing up on memory profiles.
For rough idea, on one of my Pimcore projects, it's 5.5MB and has 36k lines. On a rather simple Symfony project, it's 200KB and has 2K lines.
It seems an optimization might be possible where the FQCN in $classMap is replaced by its hash, just like $files. Since FQCN is in many cases longer than a hash (sometimes much longer), this might have a beneficial impact both on the on-disk size, but also in-memory size. I know opcache will dedup strings, but the string still needs to be kept in memory once, this will make that string shorter and should in theory improve performance.
Thoughts?
The text was updated successfully, but these errors were encountered:
perform a hash computation for each loaded class, which will have an impact on performance.
Correct, this is the tradeoff suggested. This might be an opt-in option if you know your classmap is gigantic so you get to pick if you want to pay with CPU or memory.
If you wanna trade runtime for memory, I'd suggest maybe not optimizing the classmap at all so you have a smaller classmap? But then it's rather io cost than cpu..
So yeah probably hashing would still be faster, but this seems like a very niche case to me. With opcache the classmap is only present once in memory and shared between fpm workers AFAIK, so that really shouldn't be a huge impact.
My
composer.json
:https://github.com/pimcore/demo/blob/11.x/composer.json
With some larger monolithic apps like Pimcore which include a lot of deps, autoload_static.php can grow so big it starts showing up on memory profiles.
For rough idea, on one of my Pimcore projects, it's 5.5MB and has 36k lines. On a rather simple Symfony project, it's 200KB and has 2K lines.
It seems an optimization might be possible where the FQCN in
$classMap
is replaced by its hash, just like$files
. Since FQCN is in many cases longer than a hash (sometimes much longer), this might have a beneficial impact both on the on-disk size, but also in-memory size. I know opcache will dedup strings, but the string still needs to be kept in memory once, this will make that string shorter and should in theory improve performance.Thoughts?
The text was updated successfully, but these errors were encountered: