Skip to content

perf(test): whitelist fast path for pure-decimal comparisons - #930

Merged
caomengxuan666 merged 1 commit into
masterfrom
fix/test-skeleton
Oct 20, 2026
Merged

caomengxuan666 merged 1 commit into
masterfrom
fix/test-skeleton

Conversation

@caomengxuan666

Copy link
Copy Markdown
Member

fast_decimal single-pass zero-alloc whitelist (1-18 digits, no leading zero) + eval_binary fast path for -eq/-ne/-lt/-le/-gt/-ge; leading-zero/empty/blank/+/overflow fall back to valid_number (diagnostics exact). GNU test.c arithcomp/three_arguments + general.c valid_number. Tests: lib 640 + cli 467 green, 13 bash parity groups. Honest note: end-to-end [ 1 -eq 2 ] 20k unchanged (~2.6x); skeleton is ~2% of net load, real head is word expansion of [/]/= words (~2us each) - next cut.

Canonical operands (optional '-', 1..=18 digits, no leading zero)
compare as integers directly, skipping the TestParser skeleton
(three_arguments -> binary_operator -> arithcomp, test.c:805-836)
and the double valid_number re-parse (trim + String collect +
from_str_radix, general.c:248-281). Non-canonical operands
(leading zeros, empty, whitespace, '+', overflow-width) fall back
to valid_number so GNU strtoimax semantics and diagnostics stay
exact. Micro: 165ns -> 15ns per comparison. [ / [[ dispatch
preamble untouched.
@caomengxuan666
caomengxuan666 merged commit 02cc7fa into master Oct 20, 2026
8 checks passed
@caomengxuan666
caomengxuan666 deleted the fix/test-skeleton branch October 21, 2026 08:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant