Tinkers Construct

Tinkers Construct

160M Downloads

an easy-reproduce performance issues

alex450 opened this issue · 7 comments

commented

spark : https://sparkprofiler.github.io/#nKQc3s9Uno

Versions:

  • Minecraft: 1.12.2
  • Forge: force2847
  • Mantle: Mantle-1.12-1.3.3.55
  • Tinkers Construct: TConstruct-1.12.2-2.13.0.179

so how to:
QQ截图20200310225459
put a lot of things into the smeltery controller
wait until "finish"
if the smeltery has not enough space,then the problem occurs

method slimeknights.tconstruct.library.smeltry.MeltingRecipe.matches() will not stop until someone take those things out or the smeltery have enought space

commented

Yeah, this is one of the challenges with the smeltery logic. There is no easy way to reduce the number of recipe checks once it starts melting as you can potentially have hundreds of different recipes processing in the smeltery. I even have a code comment saying just that. Really the big thing is you shouldn't have a bunch of incomplete recipes sitting in the smeltery.

commented

from a quick look at the code, i think this could be easily fixed with a LRU-cache (least-recently-used) for the melting recipes

commented

https://pastebin.com/sRBtNAVG something like this, where you have the recipes as values instead of the integers, the predicate can be your recipe.match or smth, and the supplier is your TinkerRegistry.getSmelting

commented

In general: yes. Also in general: Things aren't that easy when dealing with TileEntities because you also have to ensure client/server sync.
The best way would be to recode how things are handled in generally, but that's very prone to introducing new bugs (same for the cache). Since it's only happens in edge cases where people go really big it's not a big priority right now, especially compared to updating.

commented

i mean i can have a look at it, i give it 3 more days and they will ban you from leaving the house here aswell xD

commented

I already am working from home... but that still means I have the whole day to work. Or we'd have 1.15 soon ;P

Even if you try to fix it, I probably wouldn't accept your PR, since the chance of introducing crashes is pretty high there. And there is no way of finding them besides having a ton of setups in multiplayer (speak: servers out there) to test it.

commented

Pretty sure this is fixed in 1.16, for 1.12, don't do that? Smelteries should not be left in a processing items state basically.