AbdElAziz333 / Canary

A performance mod designed to optimize Minecraft's general performance and unofficial fork of Lithium mod for Minecraft Forge.
https://www.curseforge.com/minecraft/mc-mods/canary
GNU Lesser General Public License v3.0
41 stars 3 forks source link

Poi Optimization request (Please backport too if older versions are still supported) #214

Open Speiger opened 6 months ago

Speiger commented 6 months ago

o/ ChunkPregen dev here working on increasing compat with the lithium ports a bit, and have fixed most of it.

For future versions I do have a request. Could you change the base implementation that you use for your ListeningHashMap from OpenHashMap to LinkedOpenHashMap? The idea being that you guys turn the Map into an access cache that moves the last accessed entries to the end while least used entries get pushed to the front of the iterator.

Because at the moment ChunkPregen when a Lithium mod is installed fights with the poi system over which pois should be removed. Because the ordering roughly always stays the same and ones that should be deleted stay more likely loaded then getting unloaded.

Here is the code required to make it work.

@Override
public V put(long k, V v) {
    return putAndMoveToLast(k, v);
}

@Override
public V get(long k) {
    return getAndMoveToLast(k);
}

I doubt you guys support past the latest version, but if you do it would be really epic if you could backport this too. Have a nice day :)