Polymorph (Fabric/Forge/Quilt)

Polymorph (Fabric/Forge/Quilt)

99M Downloads

[Bug]: Smithing Table is very slow when Polymorph is installed

MuteTiefling opened this issue · 6 comments

commented

Minecraft Version

1.21.0

What happened?

May or may not be an issue on your end but figured I'd report to you as well just in case.

When performing Just Dire Things armor/tool upgrades in the Smithing Table, the game is nearly unresponsive. Here's a video, though I'm not sure how clear the issue will be there.

https://streamable.com/yihho2

Without Polymorph, these upgrades apply without issue. I suspect it's a consequence of so many different tools being allowed the same upgrade. Regular smithing table recipes are unaffected when both mods are installed. The slowdown only seems to be with JDT recipes.

How do you trigger this bug?

  1. Put a Just Dire Things tool or armor in the smithing table
  2. Add an upgrade item to the smithing table
  3. Try to pull the item out. You'll notice the delay there as if it's calculating a bunch of options

Loader

NeoForge

Loader Version

21.0.95

API Version

No response

Mod Version

1.0.3+1.21

Relevant Log Outputs

Latest log. Shows the server struggling (lines 1835 and 1841) when I attempt the Dire recipes.

commented

I ran a quick profiler and its mostly on the Polymorph side thats consuming the CPU resources. That said, its absolutely possible i'm doing something wrong in my recipes that is triggering that. So I'll keep this open on my side for now until I see how the Polymorph dev responds

commented

I think this is a two-pronged issue, which is why it only occurs with Just Dire Things recipes.

The matches method from AbilityRecipe is what determines which recipes are fetched from the Smithing Table. From what I can tell, this is matching with every upgradeable item rather than just the item currently in the grid, which means it will match with all 132 recipes. This recipe list is then passed to Polymorph, which is unoptimized for such a large list, and causes slow-down while it is being processed.

For Just Dire Things, would it be possible to filter the matching of the ability recipes more specifically?

On my end, I can definitely look into optimizing the post-processing to either limit or prevent slow-down when this occurs.

commented

I'm not sure honestly :). I mostly copied that method from the SmithingTrimRecipe - which i assume does something similar for trims. I'm looking at the code, and can't tell if trims are different?

commented

Let me know how this change looks to you C4 - I went ahead and tested in-game and I think it made a big improvement.
Direwolf20-MC/JustDireThings@5ce7860

commented

For added context, both Dire's commit on Just Dire Things and mine on Polymorph will address the issue from two different angles. Either will suffice to resolve the slowdown, but having both will be ideal for the intended behavior of the mods.

commented

Awesome, thanks all!