Skip to content

Add lossless JsonValue float mode#252

Draft
brycedrennan wants to merge 1 commit into
pydantic:mainfrom
brycedrennan:codex/lossless-jsonvalue-floats
Draft

Add lossless JsonValue float mode#252
brycedrennan wants to merge 1 commit into
pydantic:mainfrom
brycedrennan:codex/lossless-jsonvalue-floats

Conversation

@brycedrennan

@brycedrennan brycedrennan commented May 28, 2026

Copy link
Copy Markdown

Adds an opt-in JsonValueFloatMode::LosslessFloat mode that preserves non-integer JSON numbers as JsonValue::LosslessFloat(Cow<str>) instead of forcing them through f64.

Default parsing stays unchanged.

Intended to allow deserialization of numbers of arbitrary precision.

Addresses #230

After merging I'll open an integration pull request into pydantic.

@codspeed-hq

codspeed-hq Bot commented May 28, 2026

Copy link
Copy Markdown

Merging this PR will improve performance by 11.5%

⚡ 2 improved benchmarks
✅ 68 untouched benchmarks

Performance Changes

Benchmark BASE HEAD Efficiency
x100_jiter_skip 1,054.4 ns 937.8 ns +12.44%
pass2_jiter_value 19.4 µs 17.6 µs +10.57%

Tip

Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.


Comparing brycedrennan:codex/lossless-jsonvalue-floats (0f1a3a8) with main (0bb22aa)

Open in CodSpeed

@codecov

codecov Bot commented May 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@brycedrennan brycedrennan changed the title [codex] Add lossless JsonValue float mode Add lossless JsonValue float mode May 28, 2026
@brycedrennan brycedrennan force-pushed the codex/lossless-jsonvalue-floats branch 5 times, most recently from 166f5eb to 611b035 Compare May 28, 2026 04:16
@brycedrennan brycedrennan force-pushed the codex/lossless-jsonvalue-floats branch from 611b035 to 0f1a3a8 Compare May 28, 2026 06:02
@brycedrennan

Copy link
Copy Markdown
Author

@codspeedbot explain why this is faster

@codspeed-hq

codspeed-hq Bot commented May 28, 2026

Copy link
Copy Markdown

It looks like you haven't signed up on CodSpeed yet. Please visit codspeed.io to create an account, then try again.

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