Use Parsers 3 kernels for number parsing - #480
Draft
quinnj wants to merge 5 commits into
Draft
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #480 +/- ##
==========================================
+ Coverage 89.99% 90.78% +0.79%
==========================================
Files 7 7
Lines 1519 1628 +109
==========================================
+ Hits 1367 1478 +111
+ Misses 152 150 -2 ☔ View full report in Codecov by Harness. 🚀 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.
Summary
This draft updates JSON number parsing for Parsers 3 while retaining compatibility with Parsers 1 and 2 and Julia 1.9.
Int64toBigInt, andFloat64overflow toBigFloat.Float32andBigFloatvalues from the original token bytes. This removes intermediateFloat64rounding.This branch is stacked on #479 because it extends that number-parsing change. The first three commits come from #479. They can drop from this PR after #479 merges.
Compatibility design
The implementation selects a bounded adapter at compile time:
parseint,parsebigint,parsefloat, andparsenexton exact byte spans.xparseinteger adapter.BigIntownership.The package still declares
Parsers = "1, 2, 3"andjulia = "1.9". Parsers 3 itself requires Julia 1.10 or later, so Julia 1.9 resolves a compatible older Parsers release.Observable corrections
typemin(Int64)now stays anInt64.allownan=trueadds configured and native special spellings. It no longer coerces every finite number toFloat64.+are rejected as non-standard JSON.Float32andBigFloatvalues no longer double-round throughFloat64on Parsers 3.BigIntvalues have independent storage.Validation
Independent tests used the exact branch commit and exact Parsers 3 pin:
CancelTokenKeycalls.Performance
Against the stacked #479 Parsers 2 baseline on Julia 1.12.6:
Int64: within noise to 6% faster.Float64: 21% to 24% faster.BigInt: 14x to 18x faster, with about 32x fewer allocations.Float32: about 3.2x faster and correctly rounded.BigFloat: within noise to 7% faster, with one fewer allocation.Parsers 1 and 2 byte-vector float inputs require one bounded temporary
String. This is an intentional compatibility cost for correct rounding and safe behavior. Parsers 3 parses the original span directly.Dependency state
The Parsers 3 CI lane pins exact green draft head
83c7142fb714cb87261ef38eec7ab103444eb30dfrom JuliaData/Parsers.jl#210. This pin should move to the released Parsers 3 version before this PR merges.Co-authored by Codex