article --summary
The summary
This is a write-up of a talk about PHPStan Turbo, a native extension that speeds up PHPStan by up to 59%. The author covers how the project got from roughly 60 seconds down to 20 seconds in pure PHP, and then how Turbo adds to that once it is installed through Composer. Readers who only want to confirm their project is getting the speedup can jump to the slide that explains how to check that Turbo is running.
The talk also explains why native code is not automatically faster, since every crossing between PHP and C++ has a cost. The author describes shadowed classes, where PHP remains the source of truth and the C++ is an equivalent rewrite, and lists side benefits such as forking processes, restarting with OPcache enabled, and skipping type checks already verified. The write-up closes with the scale of the engine shadowing effort, the binary size work, and a notable speedup for Rector.
Slides, an English translation, and the original Czech version are linked from the article, with keyboard and fullscreen controls available.
Editorial note: This is a summary of an article first published by PHPStan. The full piece is on their site.