Repository navigation
perf(json): skip legacy decoding for nonstring tokens - #1883
Merged
Merged
Conversation
nahime0
marked this pull request as ready for review
October 18, 2026 21:44
Member
Author
|
@greptileai please review the current head 6bf9bc0. |
Contributor
[High impact] The PR appears safe to merge; no actionable issues were found. SummaryBoth architecture emitters now skip
No actionable issues found.
|
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.
Structural JSON decoding already trims every token, but then calls the legacy string decoder for numbers, literals and containers as well. Dispatch these nonstring tokens using their saved raw slice. Validate string tokens first, then call the existing unescaper only from the string branch. Both AArch64 and x86_64 follow the same path.
A GDB counter on
[[1,2,3,4],[5,6,7,8]]drops legacy unescaper calls from 11 to zero. Allocation/free counts remain 47/47. A 21-round Linux x86_64 comparison with two warmups, CPU11 affinity, isolated release-built bridge archives and concurrent-build guards changes the mixed workload JSON phase from 12.168 to 11.705 ms (1.040x by medians). The paired median speedup is 1.033x, with a bootstrap 95% interval of 1.021-1.039. All phases pass the 5% MAD gate. The whole-body difference does not have a conclusive paired interval, so this is a phase improvement, not a universal end-to-end claim. JSON representation and boxing are unchanged.Validation: all 434 JSON codegen tests pass with the real PHP oracle enabled. The new mixed-token regression checks PHP results, both optimizer modes and a clean heap-debug summary. Focused emitter tests cover all five targets in direct and PIC modes. Assembly comments and
git diff --checkpass.