symfony / symfony-docs

The Symfony documentation
https://symfony.com/doc
Other
2.18k stars 5.12k forks source link

[Performance] Remove preloading? #17643

Closed 94noni closed 1 year ago

94noni commented 1 year ago

What about removing this part: https://symfony.com/doc/6.1/performance.html#use-the-opcache-class-preloading

With Symfony v6.1 which requires PHP v8.1, I have understood it is no more relevant

alexislefebvre commented 1 year ago

With Symfony v6.1 which requires PHP v8.1, I have understood it is no more relevant

I didn't found a clear explanation but Symfony members wrote this:

But then, preloading itself is going to be almost useless as of PHP 8.1.

Source: https://symfony.com/blog/symfony-6-1-will-require-php-8-1

preloading is also mostly dead since 8.1

https://github.com/symfony/symfony/pull/44380#pullrequestreview-819949886

OskarStark commented 1 year ago

can you please help here @nicolas-grekas ? Thank you

greg0ire commented 1 year ago

Preloading gives 2 benefits:

  1. it reduces the number of autoload calls (if everything you need is preloaded, there are no autoload calls)
  2. it links types together, performing signature compatibility checks before hand.

With PHP 8.1, the second benefit is almost gone because of a newly introduced inheritance cache that also has to do with signature compatibility checks, see this benchmark: https://github.com/php/php-src/pull/6627#issuecomment-775869140

Benefit number 1 still stands though, but depending on the application, it may or may not be dwarfed by other things. On my applications, which are very few, I haven't been able to witness a significant impact from preloading. Would be nice to have benchmark from other people on other apps.

94noni commented 1 year ago

closing as related code PR was closed