Skip to content

Faster coordinate reads and writes on JSON.jl v1 (0.8.6) - #132

Open
asinghvi17 wants to merge 5 commits into
as/json1-compatfrom
as/json1-perf
Open

asinghvi17 wants to merge 5 commits into
as/json1-compatfrom
as/json1-perf

Conversation

@asinghvi17

@asinghvi17 asinghvi17 commented Oct 25, 2026 •

Copy link
Copy Markdown
Member

Stacked on #131; review that one first. After the move to JSON.jl v1, coordinates were read one generic scalar at a time with an allocation per position, and the eager Tables schema rebuilt a Union for every feature and column, so coordinate-heavy files were about twice as slow as with JSON3.

This scans Float32 and Float64 coordinates directly from the input bytes, writes coordinate text with Base.Ryu into a single buffer, and builds each column's type union once. JSON.jl internals are used only behind feature checks, with the public path as a tested fallback, and Parsers stays compatible with both 2.8.8 and 3. Output bytes and error types are unchanged.

On Julia 1.13 the minimum time to read a large polygon file falls from 103.7 ms to 45.3 ms and to write it from 111.1 ms to 56.6 ms, below JSON3's times, and read allocations drop from about 600,000 to 224. Writes allocate somewhat more temporary memory (49.5 MB instead of 32.2 MB). benchmark/run.jl reproduces the numbers, and CI now tests the dependency floors with both Parsers 2.8.8 and 3.0.0. Bumps the version to 0.8.6.

🤖 Generated with Claude Code

Keep the public reader as a guarded fallback and preserve JSON writer options through a dedicated GeoJSON write style. Support Parsers 2.8.8 and 3 without changing A’s bytes, numeric rounding, retry behavior or error types.

Harness: codex
Model: gpt-6.1-sol
…tion

Preserve the existing schema and hash order while collecting distinct types in one pass. Add reproducible coordinate benchmarks, fresh-process input checks and downstream smoke checks.

Harness: codex
Model: gpt-6.1-sol
Use concrete observed types and direct tuple slots for common arities. Share JSON’s existing String parser across input wrappers, copying mutable byte storage without consuming it. Keep small Point writes generic; use growing String-backed Ryu buffers and a guarded outer size hint to avoid repeated growth. Exercise general arities, input ownership and diagnostics, and both writer fallbacks.

Harness: codex
Model: gpt-6.1-sol
Keep lasting read, input ownership, feature id, lazy collection, type and writer checks in topical testsets. Remove historical byte/schema fixtures and migration-only serialization checks.

Harness: codex
Model: gpt-6.1-sol
Exercise non-generated scanners through typed JSON reads, roundtrips and invalid dimensions. Cover float and big IDs plus optional CRS in nonfinite collections without changing coverage thresholds.

Harness: codex
Model: gpt-6.1-sol

This branch has not been deployed

No deployments
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.

2 participants