Terminating fractions still stop early. Other fractions continue through the ordinary division loop. The nonzero remainder is retained for rounding.
Applies to one-limb divisors and sufficiently long zero-padded tails. All output limbs are still written.
Measured one change at a time
Where the time goes.
Apple M1 Max, Node 24.22.1 / arm64. Two candidate runs and an identical-code control. Ratios above 1 mean faster.
10,000 significant decimal digits. Ranges show the two runs’ medians of paired-round ratios. Patch 02 is measured on top of patch 01.
Workload
Patch 01 vs stock
Additional gain from 02
Repeating fraction · 2 / 3
3.66×
4.24–4.58×
Generic fraction · 3 / 7
3.26–3.32×
1.00–1.01×
Full-length input / 97
3.30–3.39×
1.00–1.01×
64 changing input pairs
1.78–1.81×
1.13–1.15×
2 / 3, including text conversion
2.77–2.78×
2.03×
The controls matter. The largest observed slowdowns were 5.53% for patch 01 and 5.05% for patch 02, in individual control cases. Identical-code A/A ratios varied by about 2.7%. See every case and both runs.
Inspect timings for a case
Stock80.872 µs
After patch 0122.144 µs
After patch 025.053 µs
Bars show median operation times from run 1. The table above uses paired ratios from both runs. Input creation and exact checks are outside the timer.
Review the change. Reproduce the evidence.
A compact contribution.
128,570 exact-state, independent rounding-oracle and module-parity comparisons passed. All 60 upstream test modules passed for stock and both patched stages.
The package contains the two patches, their regression tests, a benchmark runner, raw results and pinned upstream source. Earlier experiments stay outside it.
Requires Node.js, Python 3.10+ and patch. No package installation or network access. Use a new output directory.
48 cases, 11 shuffled paired rounds and batches of at least 3 ms. Correctness checked before and after timing. These are local microbenchmarks, not application-wide speedups.