guides/Router-Benchmarks.md

Router Benchmarks

Current benchmark conclusions should be read from practical API scenarios first (small and medium), with large treated as a stress/scaling check.

Last updated: 2026-02-19 03:17:48

Latest full run: benchmarks/results/bench_20260219_030929.csv

Runtime defaults: BENCH_ITERATIONS=5000, BENCH_WARMUP=500, BENCH_REPEATS=1

Core Strengths

Why Small/Medium Matter Most

Core Snapshot (Latest Full Run)

BenchmarkElapsed (ms)Ops/sMemory
core_loop:warm:small28,253176 971,102,0 MB
core_request:cold:small1 860,8642 686,922,0 MB
core_loop:warm:medium26,811186 490,6212,0 MB
core_request:cold:medium18 736,168266,8612,0 MB
core_loop:warm:large91,92754 391,2852,0 MB
core_request:cold:large198 236,30725,2252,0 MB

Memory Context (Large Scenario)

RouterWarm Memory
core_loop:warm:large52,0 MB
laravel:warm:large110,0 MB
symfony:warm:large142,0 MB
fastroute:warm:large144,0 MB
slim:warm:large146,0 MB

Methodology Notes

Regenerate

Run full benchmark:

php benchmarks/bin/benchmark_router.php

Run focused benchmark (example):

BENCH_FRAMEWORKS=core BENCH_SCENARIOS=small,medium BENCH_MODES=warm php benchmarks/bin/benchmark_router.php