Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't use parallel analyser if it doesn't save time #2831

Closed
wants to merge 1 commit into from

Conversation

SanderRonde
Copy link

After doing a bit of a deep dive into the performance of PHPStan and where most of the bottlenecks live, I found that quite a large chunk of time is spent in launching the PHPStan process, which consists of processing arguments (~130ms), finding to-check files (~250ms), building container factories (~750ms) among others. (These are the times taken for our codebase, I can share these stats in more detail if you'd like).

After realizing that (depending on the project config of course) about 1s is spent just on launching the parallel-mode subprocess I figured it might be a good idea to disable parallel mode if it's not "worth it", meaning it'll only end up checking a single file.

I think that this change will help speed up PHPStan because (at least in our codebase) it shaves off 1s from any single-file change. As you can imagine this is quite massive especially when using PHPStan pro.

It could be that this number can be bumped up a little more even, maybe checking 2 files in a row is faster than parallelizing it, but I can't definitively say that because it might differ from codebase to codebase so I'll keep the check at 1 file in this PR.

@phpstan-bot
Copy link
Collaborator

You've opened the pull request against the latest branch 1.11.x. If your code is relevant on 1.10.x and you want it to be released sooner, please rebase your pull request and change its target to 1.10.x.

@SanderRonde SanderRonde marked this pull request as draft December 16, 2023 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants