To perform a benchmark comparing OPcache and JIT in PHP 8, we will measure the execution time of different types of code:
- Without OPcache or JIT (purely interpreted PHP).
- With OPcache enabled (but without JIT).
- With OPcache and JIT enabled.
- PHP 8.4
- OPcache and JIT
- Docker and Docker Compose
docker-compose build
docker-compose up -d
-
Without Opcache and without JI Execute Fibonacci(41)... Result: 165580141 Time: 7.8981 seconds
-
With Opcache and without JIT Execute Fibonacci(41)... Result: 165580141 Time: 7.4231 seconds
-
With Opcache and JIT Execute Fibonacci(41)... Result: 165580141 Time: 2.6772 seconds