Skip to content

A few micro optimizations#8742

Merged
headius merged 7 commits intojruby:masterfrom
headius:microoptz
Apr 2, 2025
Merged

A few micro optimizations#8742
headius merged 7 commits intojruby:masterfrom
headius:microoptz

Conversation

@headius
Copy link
Member

@headius headius commented Apr 2, 2025

These can be punted to 10.x if they get too involved for release in 10.0.

@headius headius added this to the JRuby 10.0.0.0 milestone Apr 2, 2025
headius added 5 commits April 2, 2025 10:31
A static VarHandle should inline better than AtomicInteger, which
requires calling through potentially megamorphic calls for several
atomic operations.

This also avoids allocating AtomicObject.
Showed up in a profile and there were a few tweaks that might help
performance in micro ways.
This also eliminates two invalidator objects from the runtime.
headius added 2 commits April 2, 2025 10:51
Most runs of JRuby will never use coverage data, so allocating this
eagerly is wasted time and memory most of the time. This patch
makes Ruby.coverageData allocation lazy, only if directly
requested, and adds a no-allocation way to test if coverage has
been enabled. This may improve performance of execution paths that
previously acquired the field, invoked "isCoverageEnabled", read
another field, and compared that result with a constant. these
paths are potentially very hot since coverage events typically
happen on every line.
@headius headius marked this pull request as ready for review April 2, 2025 16:56
@headius headius merged commit a9aa491 into jruby:master Apr 2, 2025
57 of 72 checks passed
@headius headius deleted the microoptz branch April 2, 2025 16:57
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