SmashingMods / Alchemistry

MinecraftForge mod for 1.12.2+ inspired by minechem.
https://minecraft.curseforge.com/projects/alchemistry
GNU General Public License v2.0
61 stars 50 forks source link

TPS Performance issue caused by updateRecipe #344

Open Fros1er opened 4 months ago

Fros1er commented 4 months ago

Playing ATM9 with minecraft 1.20.1, Chemlib 2.0.19, AlchemyLib 1.0.30, Alchemistry 2.3.4. Spark reported 1.5ms per ticked used by AlchemyLib, with only ~10 dissolvers. image

I think the issue is that AbstractProcessingBlockEntity calls updateRecipe every tick, which iterates over dissolver's recipes. Unfortunately, the recipe is a linked list, and iteration is time consuming.

Maybe it's better to use a map rather than LinkedList here? Also, I'm not a minecraft modder, so I wonder whether it's necessary to update recipe on every tick.