Skip to content

[parser.c] simplify json_value_completed transition#995

Merged
byroot merged 1 commit into
ruby:masterfrom
samyron:sm/json_value_completed
Jun 5, 2026
Merged

[parser.c] simplify json_value_completed transition#995
byroot merged 1 commit into
ruby:masterfrom
samyron:sm/json_value_completed

Conversation

@samyron
Copy link
Copy Markdown
Contributor

@samyron samyron commented Jun 5, 2026

This PR simplifies the transition of of the next phase of the parser in json_value_completed. The enum json_frame_type and enum json_frame_phase are now equal when the frame->type is JSON_FRAME_ROOT, JSON_FRAME_ARRAY or JSON_FRAME_OBJECT so the next phase equal to the current frame->type.

Looking at the disassembly this saves 39 instructions.

Admittedly this may be one notch too far on the cleverness scale and an actual lookup table would be easier to reason about.

@byroot
Copy link
Copy Markdown
Member

byroot commented Jun 5, 2026

Nah, I like it. But you'll have to rebase a bit.

… transition from a JSON_PHASE_VALUE to the next phase.
@samyron samyron force-pushed the sm/json_value_completed branch from 3391c3e to 2c97de5 Compare June 5, 2026 14:50
@byroot byroot merged commit 887274e into ruby:master Jun 5, 2026
42 checks passed
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