While working on a memory benchmark of some high-throughput data structures, I realized I could use an ImmutableMap
with only a little refactoring.
Thinki
Some possible reasons:
Could that depend on your implementation of RndString.build()?
And have a look at the get() implementation of both maps: com.google.common.collect.RegularImmutableMap.get(Object) java.util.HashMap.getEntry(Object) java.util.HashMap tries to compare with "==" first. RegularImmutableMap doesn't. That may speed up
Could a different load factor be responsible for that? Perhaps the RegularImmutableMap needs more iterations to find the correct entry.