dzmingli_vs_floating/bench design
Design goal
The executable turns the library package into a reproducible experiment: fixed operations, fixed sizes, a fixed seed and protocol, and output that keeps every raw record next to the summary.
Constraints
- Published numbers are native release measurements, so the executable has to
run on
nativeand must not produce misleading numbers elsewhere. - A run must be reproducible from the repository alone: no arguments, no clock-derived seeds, no state carried between runs.
Main design decisions
- Fixed seed
0xDEC1A1and protocol. The corpus and the execution order are reproducible, and the fingerprints in the JSONL identify each dataset. - Three datasets per size.
expand_digit_scales(sizes, 3)gives three operand profiles per size, so a result is not the accident of one operand pair; with 20 confirmatory repetitions this yields 60 paired samples. - Records on standard output, report on disk. The JSONL can be piped and archived, and the HTML report is regenerated by every run.
- Abort after reporting. A run with validation failures still writes its report, then exits with a failure so that scripts cannot mistake it for a clean run.
- Native only. The published numbers are native release measurements; a
fallback
mainkeepsmoon check --target allworking on other targets.
Multiplication stops at 10,000 digits because DzmingLi’s digit estimator overflows for products above about 21,475 digits; the other operations continue to 20,000 digits. The 14 extended operations stop at 1,024 digits to keep the run length reasonable. The derivation of the ceiling is in the package design.
Correctness and invariants
The executable validates every dataset before timing it, through the library’s oracle. A size enters the paired statistics only through valid observations, as described in the package design.
Alternatives rejected
- Command-line arguments for sizes and operations. Rejected: a published
number would then depend on how the executable was called, and the recorded
replay commands could not reproduce it. Changing the experiment means
editing
main.mbt, which is versioned. - Writing the JSONL to a file chosen by the executable. Rejected: standard output can be filtered, piped and archived without the program knowing where the records go; only the HTML report has a fixed path.
- Falling back to another target. Rejected: numbers from another target are not comparable with the published native ones, so other targets print a message instead of measuring.
Boundaries
The executable does not parse arguments, choose sizes at run time, render Matplotlib figures or compare runs with each other. It describes one host and one target per run.