Re-implement backing state maps - #2883
Conversation
fb2dfc3 to
ebc6643
Compare
This uses a single array combined with efficiently computed indexes to avoid needing to do entire map equality comparisons or hold large hash-based tables, improving memory and CPU usage.
f326551 to
0e3c050
Compare
|
Real-world validation of this change at a scale well beyond the benchmark above, plus a question about reachability on older Minecraft lines. We hit the pre-#2883 behaviour in production on a 292-mod NeoForge 1.21.1 server (WorldEdit 7.3.8, NeoForge 21.1.235, Java 21.0.12, generational ZGC, Measured
That is roughly 3.4 GB of guava collections. Supporting counts line up with Before and after removing the mod, same server, same heap window, nothing else changed:
A second server on the same host, running the same pack on the same Why this is the derived index, not the block registryWorth separating, because earlier reports of this facet (#2488, #2658) were answered with the observation that WorldEdit must inherently store a list of every block, which is correct but accounts for a small fraction of the cost. In 7.3.8 the // Neighbouring state table.
private Table<Property<?>, Object, BlockState> states;built eagerly in For anyone finding this via a heap dump: FerriteCore does not help. It deduplicates vanilla's blockstate property maps, not WorldEdit's own copies, and it was active on our server throughout. Your own numbers show The questionIs a backport of this to a Minecraft 1.21.1-compatible build considered feasible? The reason for asking is that the fix is currently unreachable for anyone on that version. Following the tags: 7.3.8 is the last release targeting I appreciate that maintaining old Minecraft versions is a cost you have explicitly declined before, and I am not asking you to reopen that policy — a straight "no, use a current version" is a perfectly reasonable answer and I will take it as settled. We resolved our own incident by removing WorldEdit from that server (the work it had been installed for turned out to be impossible over RCON anyway, since region commands need a player selection context that a console does not have). I am posting the numbers mainly so the scale of what #2883 fixes is on the record, and so the next person who finds 3 GB of |
|
Not sure why you asked when you know the answer. |
This uses a single array combined with efficiently computed indexes to avoid needing to do entire map equality comparisons or hold large hash-based tables, improving memory and CPU usage.
master with obj2obj maps:

my changes:
