13
0
geforkt von Mirrors/Paper
Paper/paper-server/patches/sources/net/minecraft
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
..
advancements Add more advancement API 2021-07-09 18:50:40 +02:00
commands Vanilla command permission fixes 2021-08-25 13:19:53 -07:00
core Correctly check if bucket dispenses will succeed for event 2024-01-01 12:57:19 -08:00
nbt Reduce memory footprint of CompoundTag 2020-04-06 17:39:25 -07:00
network Add packet limiter config 2020-10-30 22:37:16 -07:00
resources Sanitize ResourceLocation error logging 2021-08-26 12:09:47 +02:00
server Add root/admin user detection 2021-09-11 22:55:14 +02:00
stats Allow statistics to be disabled/forced 2014-01-07 15:56:26 +00:00
util PreCreatureSpawnEvent 2018-01-14 17:01:31 -05:00
world Optimize HashMapPalette 2021-01-17 01:11:36 +01:00
ChatFormatting.java.patch Adventure 2021-01-29 17:54:03 +01:00
CrashReport.java.patch Deobfuscate stacktraces in log messages, crash reports, and etc. 2021-06-20 18:19:09 -07:00
CrashReportCategory.java.patch Deobfuscate stacktraces in log messages, crash reports, and etc. 2021-06-20 18:19:09 -07:00
Util.java.patch Remove client-side code using deprecated for removal AccessController 2021-11-26 15:09:58 -08:00