Closed roccodev closed 2 years ago
Same for player metadata maybe?
We've already replaced most other metadata stores with simple maps that are stored in the entity instance, so that's not needed.
We've already replaced most other metadata stores with simple maps that are stored in the entity instance, so that's not needed.
Which patch?
We've already replaced most other metadata stores with simple maps that are stored in the entity instance, so that's not needed.
This one? https://github.com/ProjectKig/KigPaper/blob/ver/1.8.8/Spigot-Server-Patches/0200-Change-metadata-to-be-non-global.patch Is this better in performance?
This adds a drop-in alternative to CraftBukkit's
BlockMetadataStore
, aiming to reduce memory footprint and increase performance.Here are some benchmark results from my machine (Ryzen 5 3600 @ 3.6 GHz, 3200 MHz RAM), with regular warmup/measurement iterations but only one fork. (YMMV)
Additionally, for a table of 20 blocks with one metadata pair each, there is a 20% size decrease. (5.9 KB -> 4.7 KB)
You can run benchmarks using these commands:
(The first two commands are hit-or-miss sometimes, if you get compilation errors just try again)
I had originally planned to use a primitive collection (
TIntObjectHashMap
), though that required an extra map inside. I think it's only justified if many metadata pairs are created for one block, to get better hash performance.It's worth noting that this also adds Mockito as a test dependency on
paperspigot-server
, as per your suggestion.