CaffeineMC / lithium-fabric

A Fabric mod designed to improve the general performance of Minecraft without breaking things
GNU Lesser General Public License v3.0
1.94k stars 189 forks source link

Fix hashed reference lists being created unnecessarily #509

Closed embeddedt closed 7 months ago

embeddedt commented 7 months ago

The original logic creates a HashedReferenceList when the list is very small (which is when the optimization would have least impact). This generates a lot of allocations when creating tiny Pools and also seems unintended. Now, the hashed implementation is used for large Pools (where it is likely to improve performance), and the list is used as-is if small enough.

embeddedt commented 7 months ago

Already fixed by https://github.com/CaffeineMC/lithium-fabric/commit/be8ee4d9e48c69bd1df47cd541fc7d7e06693836