Add Eisel-Lemire decimal parsing fast path - #3957
Draft
Yu-zh wants to merge 2 commits into
Draft
Conversation
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.
Summary
internal/strconvNOTICEMotivation
Canada coordinate values such as
-65.613616999999977have 17-19 digit mantissas that exceed the exact Clinger limit. Nearly every coordinate therefore fell back to arbitrary-precision Decimal conversion, making decimal parsing the dominant JSON decode cost.The new path handles those mantissas with cached powers and explicit ambiguity checks. Inputs that cannot be certified by the fast path continue through the existing exact conversion.
Performance
parse_double, long mantissas (4,096 parses)Existing integer and short-float paths remained within benchmark noise.
Validation
moon test internal/strconv json --target all: 228/228 passed on native, JS, Wasm, and Wasm-GCmoon check --target all --warn-list +73moon infoandmoon fmtgit diff --check.mbtichangesA full
moon test --target allrun reached an unrelated host-environment failure in the builtin Wasm tests becausewasi_snapshot_preview1.random_getwas not callable. The affectedinternal/strconvandjsonpackages pass independently on Wasm.