NAME

problem48-page-id-benchmark - compare PageStore page-id validation paths

PURPOSE

Measures the optimized Developer::Dashboard::PageStore::_validated_page_id against a local reference that reproduces its pre-fast-path normalization and validation sequence. It checks exact successful values and rejection parity for canonical, unusual, prefixed, nested, and traversal ids before timing.

WHY IT EXISTS

The saved-page route profile showed page-id validation among its repeated helpers. This benchmark records whether the canonical static-nav id fast path improves that helper without changing less common input behavior. It is a function-level diagnostic and does not claim a dashboard-wide or all-subroutine speedup.

WHEN TO USE

Run after changing _validated_page_id, _normalized_page_id, or the canonical nav-id grammar. Run the full test suite separately; benchmark output is not a substitute for security or coverage gates.

HOW TO USE

d2 docker compose exec dev perl script/problem48-page-id-benchmark
d2 docker compose exec dev perl script/problem48-page-id-benchmark --iterations 100000 --runs 9

--iterations must be positive. --runs must be an odd positive integer; the benchmark alternates which implementation runs first and reports medians. The preflight compares successful values and standard invalid-id outcomes for all parity cases. A mismatch exits with an explicit error.

WHAT USES IT

This is an opt-in Problem 48 research command. Production request handling does not load this script or its timing code.

EXAMPLES

d2 docker compose exec dev perl script/problem48-page-id-benchmark --iterations 500000 --runs 9
d2 docker compose exec dev perl script/problem48-page-id-benchmark --iterations 10000 --runs 3