Skip to content

Optimize literal fixnum and float arrays#8253

Merged
headius merged 1 commit intojruby:9.5-devfrom
headius:literal_numeric_arrays
May 31, 2024
Merged

Optimize literal fixnum and float arrays#8253
headius merged 1 commit intojruby:9.5-devfrom
headius:literal_numeric_arrays

Conversation

@headius
Copy link
Member

@headius headius commented May 21, 2024

This change detects when a literal array contains only fixnums or floats and uses indy to embed those values in a call site, greatly reducing the bytecode size for constructing the array. Arrays that are too large will not fit into the encoded String and prevent compilation, but they would not likely have fit into bytecode limits with the old logic anyway.

A benchmark is included.

@headius headius added this to the JRuby 10.0.0.0 milestone May 21, 2024
@headius headius force-pushed the literal_numeric_arrays branch 2 times, most recently from 02efdb2 to 6b46947 Compare May 31, 2024 17:21
This change detects when a literal array contains only fixnums or
floats and uses indy to embed those values in a call site, greatly
reducing the bytecode size for constructing the array. Arrays that
are too large will not fit into the encoded String and prevent
compilation, but they would not likely have fit into bytecode
limits with the old logic anyway.

A benchmark is included.
@headius headius force-pushed the literal_numeric_arrays branch from 6b46947 to 8ab3c8f Compare May 31, 2024 17:35
@headius headius merged commit a8fba13 into jruby:9.5-dev May 31, 2024
@headius headius deleted the literal_numeric_arrays branch May 31, 2024 18:27
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