Skip to content

Another round of optimizations#4019

Merged
kddnewton merged 4 commits intomainfrom
opt2
Mar 20, 2026
Merged

Another round of optimizations#4019
kddnewton merged 4 commits intomainfrom
opt2

Conversation

@kddnewton
Copy link
Collaborator

  • Use rb_ary_store instead of rb_ary_push when the array is right-sized
  • Put a cache for the constant pool on the parser since we re-hash the same bounds between the lexer and the parser (I actually would like to solve this differently, but for now it's like an 8% win)
  • Lazily unpack the line offsets the first time they are accessed so if you are a Ruby API consumer that does not touch line numbers you don't pay for the array building
  • Fast-path out of parse_arguments_list when a token cannot possibly start an argument.
  • Use an arena for building the stack that builds the AST in Ruby

@kddnewton kddnewton merged commit 7ffd9a5 into main Mar 20, 2026
67 checks passed
@kddnewton kddnewton deleted the opt2 branch March 20, 2026 16:43
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