Bad perf impact for the bootstrap.php file
romainneutron opened this issue · 9 comments
Since #16, when running a project that has phpstan/phpstan-shim in its dependencies, the bootstrap.php is called and loads the shim dependencies.
I'm not sure this is expected.
More over, loading over a phar is quite slow and has a significative performance impact (between 10ms and 25ms on an SymfonyCloud server).
Why did you do that? Is there a way to fix this perf issue?
NB : Yes, I know it's a dev dependency, however I would like to be able to run my project with dev dependencies installed without a perf impact - at least not a such big impact.
@ondrejmirtes The issue is that, PHP needs to unzip the phar archive for every request. That's both IO and CPU intensive.
But it's a dev dependency, it shouldn't matter.
Sure, your local environment will be slower but I can't imagine any real world impact from this.
People often install dev-dependency on production. It's actually quite dangerous to NOT install dev dependency on production because most applications do not have tests which checks that the application works without dev-dependecies.
Reading the Phar file when initializing the autoloader is consuming 15ms @ondrejmirtes
When deploying on SymfonyCloud, dependencies are installed with dev dependencies for instance.
And it may happen for some reason.
However, this should not be the point, let's not mix point of views and issues.
The issue I'm mentioning here is a perf issue.
As you said:
But it's a dev dependency, it shouldn't matter.
However, the issue is that installing phpstan/phpstan-shim adds an overhead by adding CPU usage when autoloader instantiates.
Please try current dev-master. 10caff5