NAME

problem48-status-route-benchmark - profile and compare the production status route

PURPOSE

Measures the warmed Web::App->handle('/system/status') route with an isolated HOME, configurable synthetic collector inventory, exact response parity checks, and optional NYTProf profiling.

WHY IT EXISTS

Problem 48 requires evidence at real application boundaries as well as at individual helpers. This benchmark keeps the same route and request data while allowing P48_LIB to select the v5.88 source tree or current checkout. It rejects non-200 responses and any body change instead of reporting a misleading timing comparison. Its report includes config-merge, filesystem-watch, and collector-projection and collector-signature counts to show whether cross-request cache reuse actually occurred. --no-collector-cache removes the cached collector projection, and --no-collector-signature-cache removes the cached canonical signature, before each request. Both controls preserve and compare exact output. --portable-config-cache disables only the configuration snapshot watcher, leaving collector-sync behavior unchanged, so workflows can compare native and portable freshness paths on each supported platform.

WHEN TO USE

Use it after changing indicator synchronization, status response assembly, authorization settings lookup, or other code executed by /system/status. Use --profile to collect NYTProf data around only the warmed request loop.

HOW TO USE

d2 docker compose exec dev perl script/problem48-status-route-benchmark --indicators 50 --iterations 100 --runs 21
d2 docker compose exec dev perl script/problem48-status-route-benchmark --indicators 50 --iterations 100 --runs 21 --no-collector-cache
d2 docker compose exec dev perl script/problem48-status-route-benchmark --indicators 50 --iterations 100 --runs 21 --no-collector-signature-cache
d2 docker compose exec dev perl script/problem48-status-route-benchmark --indicators 50 --iterations 100 --runs 21 --portable-config-cache
d2 docker compose exec dev env P48_LIB=/work/nytprof/v588/lib NYTPROF=file=/work/nytprof/status-v588.out:start=no perl -d:NYTProf script/problem48-status-route-benchmark --indicators 50 --iterations 100 --runs 21 --profile
d2 docker compose exec dev env P48_LIB=/work/lib NYTPROF=file=/work/nytprof/status-current.out:start=no perl -d:NYTProf script/problem48-status-route-benchmark --indicators 50 --iterations 100 --runs 21 --profile

The profile commands keep initialization and warmup outside the timed/profiled section. The benchmark creates and removes its synthetic HOME automatically. Its NYTProf output path is supplied through NYTPROF and should remain in an isolated ignored working directory. config_merges, watcher_checks, watcher_hits, and collector_projections report real cache behavior alongside the route timing.

WHAT USES IT

Problem 48 performance research uses this script to determine whether micro-optimizations affect the actual status endpoint and to choose subsequent work from a production-route call tree.

EXAMPLES

Example 1: run the 50-indicator route comparison.

d2 docker compose exec dev perl script/problem48-status-route-benchmark

Example 2: profile the currently selected library after warmup.

d2 docker compose exec dev env NYTPROF=file=/work/nytprof/status-route.out:start=no perl -d:NYTProf script/problem48-status-route-benchmark --profile

Example 3: validate CLI documentation.

d2 docker compose exec dev perl script/problem48-status-route-benchmark --help