PaperMC/paper-server/patches/sources/net/minecraft/world/level/chunk
stonar96 71ac6d7e6a Optimize HashMapPalette
HashMapPalette uses an instance of CrudeIncrementalIntIdentityHashBiMap
internally. A Palette has a preset maximum size = 1 << bits.
CrudeIncrementalIntIdentityHashBiMap has an initial size but is
automatically resized. The CrudeIncrementalIntIdentityHashBiMap is created
with the maximum size in the constructor of HashMapPalette, with the aim
that it doesn't need to be resized anymore. However, there are two things
that I think Mojang hasn't considered here:
1) The CrudeIncrementalIntIdentityHashBiMap is resized, when its initial
size is reached and not the next time, when a further object is added.
2) HashMapPalette adds objects (unnecessarily) before checking if the
initial size of CrudeIncrementalIntIdentityHashBiMap is reached.
This means to actually avoid resize operations in
CrudeIncrementalIntIdentityHashBiMap, one has to add 2 to the initial size
or add 1 and check the size before adding objects. This commit implements
the second approach. Note that this isn't only an optimization but also
makes async reads of Palettes fail-safe. An async read while the
CrudeIncrementalIntIdentityHashBiMap is resized is fatal and can even lead
to corrupted data. This is also something that Anti-Xray is currently
relying on.
2021-01-17 01:11:36 +01:00
..
status Duplicate UUID Resolve Option 2018-07-21 14:27:34 -04:00
storage Don't read neighbour chunk data off disk when converting chunks 2021-04-11 02:58:48 -07:00
ChunkAccess.java.patch MC Utils 2016-03-28 20:55:47 -04:00
ChunkGenerator.java.patch Configurable feature seeds 2021-08-31 17:05:27 +02:00
ChunkGeneratorStructureState.java.patch Further Seed Customisation 2014-07-04 13:28:45 +10:00
DataLayer.java.patch Remap CraftBukkit to Mojang+Yarn Mappings 2024-12-11 22:26:55 +01:00
EmptyLevelChunk.java.patch MC Utils 2016-03-28 20:55:47 -04:00
HashMapPalette.java.patch Optimize HashMapPalette 2021-01-17 01:11:36 +01:00
LevelChunk.java.patch Optimise Chunk#getFluid 2020-01-14 14:59:08 -08:00
LevelChunkSection.java.patch Optimise Chunk#getFluid 2020-01-14 14:59:08 -08:00
PalettedContainer.java.patch Synchronize PalettedContainer instead of ThreadingDetector/Semaphore 2020-05-29 20:29:02 -04:00
ProtoChunk.java.patch MC Utils 2016-03-28 20:55:47 -04:00