NAME
problem48-path-identity-benchmark - compare scoped path-identity reuse
PURPOSE
This benchmark compares the production all_paths aggregate with per-inventory path-identity reuse against the same registry with that cache disabled. It refuses to report timings unless both implementations produce byte-identical JSON.
WHY IT EXISTS
Problem 48 uses Devel::NYTProf to identify repeated filesystem path normalization in Developer Dashboard. This benchmark measures the aggregate impact of one request-scoped optimization without adding state across calls or touching the user's home directory.
WHEN TO USE
Run this in the isolated Problem 48 Docker benchmark environment after changing Developer::Dashboard::PathRegistry::all_paths or its path identity helper. It is a synthetic empty-home measurement, not a claim that every dashboard routine is 50 times faster.
HOW TO USE
perl script/problem48-path-identity-benchmark
perl script/problem48-path-identity-benchmark --runs 51
The run count must be odd and positive. Each pair uses the same temporary home and state directory; a fresh result is compared with the baseline on every iteration.
WHAT USES IT
Problem 48 performance research uses this script to decide whether aggregate-scoped path normalization is worth retaining. The application and release workflow do not invoke it.
EXAMPLES
Run the default comparison inside the scoped Docker benchmark project:
d2 docker compose -p dd-problem48-bench -f /tmp/d2-problem48-bench.yml -f /tmp/d2-problem48-init.yml run --rm bench perl script/problem48-path-identity-benchmark
Increase the alternating sample count for a steadier median:
d2 docker compose -p dd-problem48-bench -f /tmp/d2-problem48-bench.yml -f /tmp/d2-problem48-init.yml run --rm bench perl script/problem48-path-identity-benchmark --runs 51