Lower load factors in BlockMap

We can sacrifice these tiny amounts of memory for large CPU gains.
This commit is contained in:
Octavia Togami 2020-02-09 15:25:43 -08:00
parent f111f6bfce
commit 3ed190268c
No known key found for this signature in database
GPG Key ID: CC364524D1983C99
2 changed files with 4 additions and 4 deletions

View File

@ -58,7 +58,7 @@ public class BlockMap<V> extends AbstractMap<BlockVector3, V> {
========================= */
public static <V> BlockMap<V> create() {
return create(() -> new Int2ObjectOpenHashMap<>(64, 1f));
return create(() -> new Int2ObjectOpenHashMap<>(64, 0.9f));
}
public static BlockMap<BaseBlock> createForBaseBlock() {
@ -118,7 +118,7 @@ private static BlockVector3 reconstructLocation(long group, int inner) {
return BlockVector3.at(x, y, z);
}
private final Long2ObjectMap<Int2ObjectMap<V>> maps = new Long2ObjectOpenHashMap<>(4, 1f);
private final Long2ObjectMap<Int2ObjectMap<V>> maps = new Long2ObjectOpenHashMap<>(4, 0.75f);
private final Supplier<Int2ObjectMap<V>> subMapSupplier;
private Set<Entry<BlockVector3, V>> entrySet;
private Collection<V> values;

View File

@ -67,8 +67,8 @@ private static BaseBlock assumeAsBlock(int id) {
return state.toBaseBlock();
}
private final Int2IntMap commonMap = new Int2IntOpenHashMap(64, 1f);
private final Int2ObjectMap<BaseBlock> uncommonMap = new Int2ObjectOpenHashMap<>(1, 1f);
private final Int2IntMap commonMap = new Int2IntOpenHashMap(64, 0.9f);
private final Int2ObjectMap<BaseBlock> uncommonMap = new Int2ObjectOpenHashMap<>(1, 0.75f);
{
commonMap.defaultReturnValue(BlockStateIdAccess.invalidId());