NAME
problem48-runtime-root-benchmark - compare request-scoped runtime-root access
PURPOSE
Measures repeated runtime_root reads against the pre-cache body using a precomputed operation-local runtime-layer inventory. The output path must match exactly before a timing result is reported. It also compares the complete all_paths inventory with the previous runtime_root body and requires byte-identical canonical JSON before reporting the aggregate timing.
WHY IT EXISTS
The warmed saved-page NYTProf profile attributed repeated calls to PathRegistry::runtime_layers. This benchmark isolates the accessor dispatch and list-copy cost without including filesystem discovery in the timed loop, then checks whether that helper improvement moves the real all_paths aggregate.
WHEN TO USE
Use inside the repository's Docker development service after changing the operation-scoped runtime_root fast path. This microbenchmark does not predict whole-route latency or prove the universal 50x objective.
HOW TO USE
d2 docker compose exec dev perl script/problem48-runtime-root-benchmark
d2 docker compose exec dev perl script/problem48-runtime-root-benchmark --iterations 1000000 --runs 21
The run count must be odd and positive. Baseline and optimized loops alternate order on one isolated temporary home and compare exact returned paths.
WHAT USES IT
Problem 48 performance research uses this script; the application and release workflow do not invoke it.
EXAMPLES
Run the default comparison:
d2 docker compose exec dev perl script/problem48-runtime-root-benchmark
Use more calls and samples when the per-call duration approaches timer resolution:
d2 docker compose exec dev perl script/problem48-runtime-root-benchmark --iterations 1000000 --runs 21