PneumaticCraft: Repressurized

PneumaticCraft: Repressurized

43M Downloads

Performance: Heat Frame spends a lot of time looking for smelting recipes

andrewsf opened this issue ยท 3 comments

commented

Describe the bug

Profiling my low-TPS 1.16.5 world, I found a fair amount (over 5%) of CPU time spent in EntityHeatFrame's tick method. There's only one Heat Frame in my entire world, and it has just been sitting idle on a barrel that has < 23 stacks of Plastic Sheet (which I left in there over two years ago).

99.5% of the time is spent inside tryCookSlot(...) calling level.getRecipeManager().getRecipeFor(IRecipeType.SMELTING, ...).

I noticed an LRU cache @ CraftingRecipeCache used for RecipeType.CRAFTING recipes -- maybe something similar could be adopted for RecipeType.SMELTING recipes?

The code in this area looks mostly identical in master, so I imagine this problem & solutions are still meaningful in the latest 1.19 versions of the mod too.

How to reproduce the bug

  1. Put a bunch of stacks of items in a barrel.
  2. Put a Heat Frame on the barrel.
  3. Get the Heat Frame nice and hot.

Expected behavior

Very little time spent looking up the same smelting recipes repeatedly.

Additional details

No response

Which Minecraft version are you using?

1.16

Which version of PneumaticCraft: Repressurized are you using?

1.16.5-2.15.11-334

Crash log

No response

commented

Yeah I could see that spending excessive time searching, especially if there are many furnace recipes in your instance.

Can you try build 338 from https://jenkins.k-4u.nl/job/PneumaticCraft-Repressurized-1.16/ and let me know if that helps?

commented

Looking much better for me! No perceptible activity from the heat frame at all. Thanks for hitting this one so fast.

commented

Fixed for 1.16/1.18/1.19