PaperMC/paper-server/patches/sources/net/minecraft/world
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
..
damagesource Add critical damage API 2021-07-26 17:32:36 +02:00
effect Add ElderGuardianAppearanceEvent 2021-03-19 23:39:09 -04:00
entity Prevent excessive velocity through repeated crits 2021-11-25 10:25:09 +01:00
food EntityRegainHealthEvent isFastRegen API 2016-04-22 01:43:11 -05:00
inventory fix various menus with empty level accesses 2021-07-11 12:52:56 -07:00
item Option to prevent data components copy in smithing recipes 2021-09-26 12:57:28 -07:00
level Optimize HashMapPalette 2021-01-17 01:11:36 +01:00
scores Don't save empty scoreboard teams to scoreboard.dat 2016-05-07 23:33:08 -04:00
BossEvent.java.patch Adventure 2021-01-29 17:54:03 +01:00
CompoundContainer.java.patch Remap CraftBukkit to Mojang+Yarn Mappings 2024-12-11 22:26:55 +01:00
Container.java.patch Remap CraftBukkit to Mojang+Yarn Mappings 2024-12-11 22:26:55 +01:00
RandomizableContainer.java.patch LootTable API and replenishable lootables 2016-05-01 21:19:14 -04:00
SimpleContainer.java.patch Remap CraftBukkit to Mojang+Yarn Mappings 2024-12-11 22:26:55 +01:00