Skip to content

Cached fixnums for immediate values#9101

Merged
headius merged 4 commits intojruby:masterfrom
headius:cached_fixnums
Dec 2, 2025
Merged

Cached fixnums for immediate values#9101
headius merged 4 commits intojruby:masterfrom
headius:cached_fixnums

Conversation

@headius
Copy link
Member

@headius headius commented Dec 1, 2025

See #9096.

@headius headius added this to the JRuby 10.0.3.0 milestone Dec 1, 2025
@headius headius changed the title Cached fixnums Cached fixnums for immediate values Dec 1, 2025
This allocates and reuses the following values to avoid them being
constructed repeatedly:

* nil.__id__ and nil.hash
* true.__id__ and true.hash
* false.hash (false.__id__ is already cached as a zero RubyFixnum)
* rubyString was the same deduplicated bytes and redundant.
* symbolBytes was the same bytes but not deduplicated.
* newShared predated fstring and was unnecessary for all uses.
* getBytes can just use fstring's ByteList
@headius headius force-pushed the cached_fixnums branch 2 times, most recently from 80dc960 to ded78db Compare December 2, 2025 00:02
* int values and finals first
* Lazily initialized values at end
@headius headius marked this pull request as ready for review December 2, 2025 00:50
@headius headius merged commit 5185f39 into jruby:master Dec 2, 2025
77 checks passed
@headius headius deleted the cached_fixnums branch December 2, 2025 00:50
headius added a commit to headius/jruby that referenced this pull request Dec 2, 2025
Cached fixnums for immediate values
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