Towdium / JustEnoughCalculation

A simple minecraft mod help you calculate the cost for recipes
Other
53 stars 36 forks source link

[1.18] Performance lag coming from complex recipe calculation now affects gameplay even when the calculator is not open #126

Open progheal opened 1 year ago

progheal commented 1 year ago

Symptom: When a calculator is in the inventory and it is currently showing complex recipe, the lag described in #99 is now experienced even when calculator is not open; specifically, this lag will occur with every operation involving inventory item movement. This lag is not happening if the calculator is not directly in the player inventory, be it in a backpack or in a chest.

Environment:

Additional info: The modpack comes with spark mod, so I did a profile run over 30 seconds. Here's the profiler trace: https://spark.lucko.me/5NL6RZWSvB During these 30 seconds, I moved some items around, crafted something, and scroll-wheeled items in and out of a backpack; every time I do some operation (take item up, put item down, scroll wheel one item, etc.) the lag happened. The calculator is in my inventory (not even in hotbar so I never opened it during the time), and is displaying a complex recipe (a high level Solar Panel from Solar Flux Reborn) that is, I think, 6 to 7 levels deep. Upon inspecting the profiler trace, I found out many calls on GuiScreenHandler of this mod that takes up some significant amount of time in various places. I am a little confused about why it's drawing GUI despite I never opened the calculator during profiling, so I came here, did a quick search on lag and found #99, which gave me suspicion that it is because the currently displayed recipe. I then tried changing it to show the lowest level Solar Panel recipe that's only 2 level deep, and the lag accompanying item manipulation is gone.

MechanicalDragon0687 commented 1 year ago

I am also experiencing this in client-only mode, even when inventory detection is off...this leads me to believe that its running the inventory detection code regardless of whether the option is enabled or disabled, and then just ignoring the results if "disabled"

I assume this is related to the "widget" as that is where the code is running, but I dont see a way to open or disable the widget with my current modset. would be nice to be able to just disable the widget entirely by config