Repository navigation
Use packed-int hash tables in java7 RegularImmutableSet. - #8883
Open
copybara-service[bot] wants to merge 1 commit into
Open
copybara-service[bot] wants to merge 1 commit into
copybara-service[bot] wants to merge 1 commit into
Conversation
Replace `RegularImmutableSet`'s `@Nullable Object[]` hash table with a 3-tier packed `int @nullable []` table (`OCCUPIED_BIT | tag | elementIndex`, `ABSENT = 0`, `OCCUPIED_BIT = Integer.MIN_VALUE`) to eliminate GC-traced table references, skip `Arrays.fill` on table allocation, and filter hash-tag misses before dereferencing `elements`. Also remove the `mask` field (shrinking the wrapper from 40 B to 32 B under compressed oops), set `EMPTY.table = null`, add `==` fast-paths before `.equals()`, skip `toArray()` in `ImmutableSet.copyOf(Collection)` when empty, and tighten `MemoryTester` bounds in `ImmutableSetTest` and `ImmutableSetMultimapMemoryTest`. RELNOTES=Improved java7/Android ImmutableSet lookup performance and memory footprint. PiperOrigin-RevId: 1025024945
copybara-service
Bot
force-pushed
the
test_1025024945
branch
from
November 20, 2026 20:29
69df984 to
e0d62b9
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Use packed-int hash tables in java7 RegularImmutableSet.
Replace
RegularImmutableSet's@Nullable Object[]hash table with a 3-tier packedint @Nullable []table (OCCUPIED_BIT | tag | elementIndex,ABSENT = 0,OCCUPIED_BIT = Integer.MIN_VALUE) to eliminate GC-traced table references, skipArrays.fillon table allocation, and filter hash-tag misses before dereferencingelements. Also remove themaskfield (shrinking the wrapper from 40 B to 32 B under compressed oops), setEMPTY.table = null, add==fast-paths before.equals(), skiptoArray()inImmutableSet.copyOf(Collection)when empty, and tightenMemoryTesterbounds inImmutableSetTestandImmutableSetMultimapMemoryTest.RELNOTES=Improved java7/Android ImmutableSet lookup performance and memory footprint.