Repository navigation
[perf] Fork parallel workers from the main process when PHPStan Turbo is loaded - #8929
samsonasik wants to merge 5 commits into
Conversation
|
@TomasVotruba ready 👍 |
|
I've benched this on a real Symfony project - Mautic
The fork only saves the fixed boot cost per worker. On small projects like CodeIgniter For that gain, this adds a second worker lifecycle - fork, Thank you for the effort and the detailed measurements though 👍 |
|
The gain here seems so tiny for such a complexity to pay off. Closing this one. |
This PR improve parallel process performance by using
pcntl_forkwhen possible, as a forked worker is a copy of the already initialized PHP process, so it can start working right away, see my post at dev to that I applied the performance improvement onStructArmedviapcntl_forkwhen possible:https://dev.to/samsonasik/structarmed-fast-php-architecture-guards-you-can-rely-on-3be3#an-even-faster-parallel-process
Measured with
bench/parallel_memory_bench.php, 8 workers, 3 cold runs each, PHP 8.4, same php.ini with PHPStan Turbo loaded on both sides:systemsrcWithout PHPStan Turbo loaded in the main process, workers are still spawned and nothing changes.