Skip to content

Various array optimizations#8484

Merged
headius merged 8 commits intojruby:10-devfrom
headius:array_optz
Dec 4, 2024
Merged

Various array optimizations#8484
headius merged 8 commits intojruby:10-devfrom
headius:array_optz

Conversation

@headius
Copy link
Member

@headius headius commented Dec 4, 2024

No description provided.

This replaces most uses of newArray(size) with the following
sequence:

1. new raw array, without filling entries with nil
2. population code, append values into the array
3. finish raw array, only populate remaining entries with nil

This reduces the overhead for constructing these arrays by avoiding
the pre-population with nil values for elements that will just be
overwritten anyway.
@headius headius added this to the JRuby 10.0.0.0 milestone Dec 4, 2024
@headius headius changed the base branch from master to 10-dev December 4, 2024 21:06
This guarantees we do not accidentally start referencing any
surrounding state and allocating a lambda object.
* Use more newRawArray where appropriate
* Use newEmptyArray for more arrays intended to be empty
* Provide "each" logic for global names
* More efficient iteration of Java methods in JavaLang Class ext
@headius headius merged commit d1df227 into jruby:10-dev Dec 4, 2024
49 of 72 checks passed
@headius headius deleted the array_optz branch December 4, 2024 23:15
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