◐ Shell
clean mode source ↗

Improve `json.loads` performance by moreal · Pull Request #6704 · RustPython/RustPython

This was referenced

Jan 13, 2026

@moreal moreal changed the title WIP: Improve json.loads Improve json.loads

Jan 14, 2026

@moreal moreal marked this pull request as ready for review

January 14, 2026 17:55

coderabbitai[bot]

@moreal moreal changed the title Improve json.loads Improve json.loads performance

Jan 14, 2026
Parse JSON constants (null, true, false) directly in Rust within
call_scan_once() instead of falling back to Python scan_once.
This reduces Python-Rust boundary crossings for array/object values.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Parse JSON numbers starting with digits (0-9) directly in Rust within
call_scan_once() by reusing the existing parse_number() method.
This reduces Python-Rust boundary crossings for array/object values.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Parse special JSON constants (NaN, Infinity, -Infinity) and negative
numbers directly in Rust within call_scan_once(). This handles:
- 'N' -> NaN via parse_constant callback
- 'I' -> Infinity via parse_constant callback
- '-' -> -Infinity or negative numbers via parse_constant/parse_number

This reduces Python-Rust boundary crossings for array/object values.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

youknowone

youknowone