NAME

problem48-collector-config-benchmark - measure collector config-read reuse

PURPOSE

Compares the pre-optimization collector assembly flow, which reads installed skill config entries twice, with Config::collectors, which reuses the entries loaded while constructing merged configuration. It checks exact canonical output parity, enumeration counts, and alternating timing medians.

WHY IT EXISTS

Problem 48 profiling exposed repeated per-skill config reads in the collector path. This benchmark provides a repeatable, isolated measurement for deciding whether sharing the existing entry list meaningfully reduces that work.

WHEN TO USE

Use this in the isolated Problem 48 Docker bench after changing collector configuration loading, entry reuse, or layered skill config semantics. Its synthetic timings are workload-specific and are not a claim that every Dashboard subroutine meets the 50x objective.

HOW TO USE

perl script/problem48-collector-config-benchmark
perl script/problem48-collector-config-benchmark --skills 1000 --runs 9

The defaults create 250 skill configs with 80 unrelated fields and one collector each, then perform 21 alternating comparisons. --runs must be an odd positive integer. Temporary fixtures are removed automatically.

WHAT USES IT

Problem 48 performance research uses this script to verify the collector entry-sharing improvement. The dashboard runtime and release build do not invoke the benchmark.

EXAMPLES

Run a short exact-parity check:

perl script/problem48-collector-config-benchmark --skills 3 --runs 1

Measure the default workload in the isolated benchmark project:

d2 docker compose -f /tmp/d2-problem48-bench.yml run --rm bench perl script/problem48-collector-config-benchmark

OUTPUT

The first line reports fixture size, run count, exact parity, and old/new skill-entry enumeration counts. The second line reports medians and the observed ratio. The ratio is descriptive; the script does not impose a machine-dependent speed threshold.