Skip to content

Commit

Permalink
Optimize the memory footprint of MapMakerInternalMap entries by spe…
Browse files Browse the repository at this point in the history
…cial-casing linked entries.

The first entry in each bucket does not need a `next` field because it will only ever be the tail of the bucket's linked list. Because `MapMakerInternalMap` uses a load factor of 0.75, we can expect that most entries are tails, so long as the hash function is good.

For the common use case of a weak interner with compressed OOPs, omitting the `next` field reduces the shallow heap of `WeakKeyDummyValueEntry` from 40 bytes to 32 bytes.

RELNOTES=Memory optimizations for `Interner` and `MapMaker`
PiperOrigin-RevId: 479157599
  • Loading branch information
java-team-github-bot authored and Google Java Core Libraries committed Oct 5, 2022
1 parent 5ed6e43 commit a2e8f3c
Show file tree
Hide file tree
Showing 2 changed files with 332 additions and 261 deletions.
Loading

0 comments on commit a2e8f3c

Please sign in to comment.