
This is the last article in a series I’ve written about understanding how PHP works. In this article, we will cover JIT in PHP.
For some background, I recommend my previous posts on this topic:
I’ve covered JIT before, so for this article, I’ll just share my slide notes.
Function JIT problems
- Generally only improves the performance of CPU-bound apps
- JIT works better with strict types (use strict_types = 1)
- Function-based JIT can’t refer to objects
- JIT is useful with real hot-spots
- Doesn’t check whether the code is frequently used or not
- Need a smarter way (Tracing JIT)
JIT-friendly code

- Strictly typed code and functions with scalar types can help JIT to infer types and make use of CPU registers.
- Use declare(strict_types=1);