NAME
problem48-skill-layer-inventory-benchmark - measure layered skill lookup reuse
PURPOSE
This benchmark compares the current per-skill filesystem-root scan with a candidate operation-scoped installed-skill inventory lookup. Every timed run verifies the same ordered layer results.
WHY IT EXISTS
NYTProf found repeated skill-root work during dashboard page rendering. The candidate reuses directory names already read by the request, but it is kept out of production unless a realistic scoped benchmark shows a gain.
WHEN TO USE
Run this benchmark after changing skill-layer discovery or its request-local inventory. It measures only the tested synthetic skill workload, not the entire dashboard or the Problem 48 50x target.
HOW TO USE
d2 docker compose -p dd-problem48-bench -f /tmp/d2-problem48-bench.yml -f /tmp/d2-problem48-init-gate.yml run --rm bench perl script/problem48-skill-layer-inventory-benchmark
d2 docker compose -p dd-problem48-bench -f /tmp/d2-problem48-bench.yml -f /tmp/d2-problem48-init-gate.yml run --rm bench perl script/problem48-skill-layer-inventory-benchmark --skills 250 --runs 31
OUTPUT
The report gives skill and layer counts, median milliseconds, exact ordered-layer parity, and relative speed. Any output mismatch or filesystem error terminates the command visibly.
SAFETY
All generated directories and marker files live in an automatically removed temporary directory. The benchmark does not modify dashboard configuration or installed skills.