Tests: a leaner differential for the character-range scan - #151
Merged
Merged
Conversation
The reference loop now returns its verdict instead of throwing it, malformed and overlong sequences told by `ismalformed`/`isoverlong`, the test of `UInt32(c)`; the four-byte sequences come from eight bytes and the placed cases from the single bytes and the curated cases. A throw costs a backtrace: the block goes from 18 s to 4.5 s here, the suite from 72 s to 54 s. Assisted-by: Claude (Anthropic)
mathieu17g
force-pushed
the
charscan-test-diet
branch
from
September 11, 2026 22:11
6bf4b07 to
103f8ef
Compare
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #151 +/- ##
=======================================
Coverage 96.67% 96.67%
=======================================
Files 15 15
Lines 2649 2649
=======================================
Hits 2561 2561
Misses 88 88 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The differential test that #148 added compares the scan with the loop it replaced on every code point, on short byte sequences and on placed cases. It threw about 100,000 exceptions per run, and a throw costs a backtrace: about 10 s of the suite on my machine, and about 30 s on the Linux runners (152 s to 184 s). The macOS aarch64 job varies from 109 s to 411 s from one run to the next, with or without these tests, so its time says nothing here.
The reference loop now returns its verdict instead of throwing it, with
Base.ismalformedandBase.isoverlongas the testUInt32(c)applies before it throws; the four-byte sequences come from an eight-byte alphabet and the placed cases from the twenty single bytes and the eighteen curated cases. Every code point, bothSubStringpaths and theStringViewcase stay. The block runs in 4.5 s instead of 18 s on my machine, and the suite in 54 s instead of 72 s; the Linux jobs are back to 139 s and 97 s.