Benchmarks

All benchmarks run on Apple M4 (14 cores), comparing zphp (ReleaseFast) against PHP 8.5 (no JIT). Benchmarks are in the benchmarks/ directory and can be reproduced locally.

Runtime

Six compute-heavy benchmarks. Best of 5 runs. Startup overhead is subtracted to measure pure execution time.

BenchmarkPHPzphpRatio
string_ops97 ms27 ms0.28x
array_ops98 ms29 ms0.30x
objects97 ms36 ms0.37x
closures98 ms83 ms0.85x
loops130 ms120 ms0.92x
fibonacci161 ms157 ms0.97x
zig build -Doptimize=ReleaseFast
./benchmarks/runtime/run

HTTP throughput

Measured with wrk: 4 threads, 100 connections, 10 seconds. All servers return echo "hello".

Serverreq/sAvg latency
zphp serve92,3431.12 ms
nginx + php-fpm (128 workers)42,08850.37 ms

2.2x throughput, 45x lower latency compared to nginx + php-fpm.

zig build -Doptimize=ReleaseFast
./benchmarks/serve/wrk_bench

Note: nginx + php-fpm numbers are from Docker with linux/amd64 emulation on Apple Silicon. Native Linux performance would be better for php-fpm. These numbers are directional, not absolute. Run the benchmarks on your own hardware for numbers relevant to your deployment.

Formatter

Formatting a 416-line PHP file. Best of 10 runs.

ToolTime
zphp fmt5 ms
php-cs-fixer (PSR-12)92 ms
prettier @prettier/plugin-php95 ms
./benchmarks/fmt