Issue #2535: Count an unrolled if-chain automaton against a table loop and regex-automata before @unroll is shaped

Open and answer this issue on GitHub.

ready · opened 2026-11-21 · updated 2026-11-21 · 0 comments

Part of #906

What it is

ADR-specialization-1 lets a library unroll a loop over a build-time value (@unroll) and decide its branches while building, so a regular expression’s automaton (#673) can become code instead of a table. Whether that code is faster than a table is not measured: the @unroll lowering may only be shaped after this count (was #906 item 2). If the if s == k chain does not become a jump table, match arms written from a list become a question of their own (ADR-specialization-1 §4).

To build

  1. Hand-written Rust in the form the lowering would emit (a loop over bytes with an if s == k chain per state) against the same DFA as a table loop and against regex-automata’s dense DFA; callgrind instruction counts, release builds, the same output first (docs/measuring.md); the table in benches/.

Done when

A table in benches/ gives the three instruction counts on the same input and output, and states whether the chain became a jump table; the commit carries Fixes #N for this issue, and the report gives a Found: line if the chain is slower than the table.

Split from #906 by Claude Code

Back to Open Issues