Integrated Dynamics

Integrated Dynamics

63M Downloads

Lag when using JEI in Storage Terminal Crafting Window

FoundryCove opened this issue ยท 31 comments

commented

name: "๐Ÿ› Bug report"
about: If something is not working as expected or crashes


Issue type:

  • ๐Ÿ› Bug

Short description:

When bringing up a crafting recipe that can take different block variants (e.g. wood planks, glass blocks) the game can slow down or outright freeze, depending on how many variants the recipe takes. There is no performance drop for recipes without variations. This only seems to happen on large inventory networks. I've been seeing this issue since at least 30,000 items in inventory, but it may have started with less than that. The multithreading crafting option does not seem to make any difference. My network is Sophisticated Storage multiblock hooked to a storage terminal.

Steps to reproduce the problem:

  1. Open Storage Terminal, fixed or portable
  2. Switch to crafting tab
  3. Select a crafting recipe in JEI that has multiple item variations
  4. If there is a large amount of items in the inventory network the game will slow or even completely freeze. Glass seems to be the worst as it has many variants in ATM 8.
  5. Game will continue to run poorly until the crafting preview is closed.

Expected behaviour:

I expected the game to preview crafting recipes without issues.


Versions:

  • This mod: Integrated NBT 1.6.0
    Integrated Crafting 1.0.26
    Integrated Dynamics 1.14.7
    Integrated Terminals 1.4.2
    Integrated Tunnels 1.8.18
  • Minecraft: 1.19.2
  • Forge: 43.2.3

Log file:

https://spark.lucko.me/Bfs7wjj0Zb

commented

@rubensworks I didn't change anything since last time, but besides a hang on opening the recipes, it doesn't lag while viewing them now.

commented

Ok, that's what the fix intended to do.
The hang on opening will be fixed in a later version (as it requires some more invasive changes).

commented

@FoundryCove Your issue appears to be not following one of the allowed issue templates, which breaks our automation tools. Please update your issue to the proper template.

commented

Also, please share your profiling log as explained in https://github.com/CyclopsMC/CyclopsCore/blob/master-1.18/.github/CONTRIBUTING.md#performance-issues-snail

GitHub
Minecraft library mod for EvilCraft, Integrated Dynamics and others. - CyclopsCore/CONTRIBUTING.md at master-1.18 ยท CyclopsMC/CyclopsCore
commented

I updated the format of the issue. I'm not sure what mod version to put? There's several integrated mods in ATM 8, which one is relevant here? I'm running the mod in All The Mods 8 v1.0.10

BTW I'll have a profile log soon.

commented

I linked the spark profile upload. I ran it from just before I opened the portable terminal, to just after I closed the window after it froze up.

commented

There's several integrated mods in ATM 8, which one is relevant here? I'm running the mod in All The Mods 8 v1.0.10

Could you add all of them?

commented

Added the version numbers for all the Integrated mods in the pack

commented

I just pushed a fix which will significantly boost performance.
However, I noticed a deeper problem thanks to this issue, which I will look into next, but will take a bit more time.
So if you still get some performance issues after this change (perhaps on networks with many changes per second), then the next upcoming update might help with things.

commented

crash-2023-02-18_04.01.06-client.txt This update seems to cause a crash on load with ATM 8. No other mods where changed.

commented

That crashlog seems to have nothing to do with this mod, but with some kind of model-fixing mod.

java.lang.IllegalAccessError: failed to access class net.minecraft.client.renderer.block.model.ItemModelGenerator$SpanFacing from class net.mehvahdjukaar.modelfix.ModelFix (net.minecraft.client.renderer.block.model.ItemModelGenerator$SpanFacing is in module [email protected] of loader 'TRANSFORMER' @6fe04f2a; net.mehvahdjukaar.modelfix.ModelFix is in

commented

I updated the mods and it still let me join the server I've been playing on without them doing anything, but there wasn't any difference in performance. Would they need to update for me to see a difference?

commented

image
From what I saw in the issues page for this mod(https://beta.curseforge.com/minecraft/mc-mods/model-gap-fix), something about it messes with the crash log, but it was just an issue with other integrated mods in the pack being outdated

commented

@rubensworks I got the server world and ran it in singleplayer with the newest version of the mod. This issue does not seem to have been resolved. I tested it ~2000, ~100,000, and ~400,000 items in the network. All showed the same freezing issue.

commented

This is what I said before:

So if you still get some performance issues after this change (perhaps on networks with many changes per second), then the next upcoming update might help with things.

In any case, a new profiling log can definitely help.

commented

Will I just need these just on my client, or will the server need to be updated?

commented

Just a client update might be sufficient in your case.
But the changes cover more than just this issue, so you should also see generally better performance server-side as well when applying these changes server-side.

commented

@FoundryCove Just published new releases of CC, ID, and ITerminals. It should significantly improve performance.
Could you let me know how it works out on your end?
There's still one more improvement I can do if it's still not enough, but I'd want to avoid taking that road until absolutely necessary.

commented

With my inventory at 4.17 million items there's a 5-10 sec hang when opening the storage terminal. Still getting a freeze condition with some item's crafting recipes. The interface freezes every time an item is added to a network.

commented

With my inventory at 4.17 million items there's a 5-10 sec hang when opening the storage terminal. Still getting a freeze condition with some item's crafting recipes. The interface freezes every time an item is added to a network.

And is there any improvement compared to the previous version? (there should be ...)

commented

I'm not sure, I switched servers in the meantime and didn't use integrated dynamics on the new one.

commented

Could you send me a new profiling log in that case?

commented

Just wanted to chime in. Still seeing this using the latest version of FTB Skies with the latest version of IntegratedDynamics, IntegratedTerminals, IntegratedTunnels, IntegratedCrafting, Integrated NBT, and CyclopsCore.

My profiling log can be found here: https://spark.lucko.me/W43Fsfi5BQ

spark is a performance profiler for Minecraft clients, servers, and proxies.
commented

Relevant area of the profiling output appears to be here:

image

commented

Thanks @glektarssza!

commented

I will also test this update as I believe my issue to be at least 25% due to network systems as lag didn't exist until I used variables.

commented

@glektarssza or @Snonky, could you try out the latest CyclopsCore release, to see if this improves performance on your end?
The previous optimization had a flaw where it would not apply in some cases, which is why performance was horrible on your end. The latest release may fix this.

@Snonky With this optimization, our temporary cache workaround may not be needed anymore.

There's also a chance that this improves performance, but is still too laggy. In this case, I have another improvement in mind.

commented

@rubensworks Very good improvement. No more freezing, just low frames. With the cache the frames are more stable. I think having both improvements is viable to make it work with even bigger storages and to be kind to the client's CPU usage ^^

CyclopsCore 1.18.4:

jei_test_cycore1.18.4.mp4

CyclopsCore 1.18.4 + cache:

jei_test_cycore1.18.4_with_cache.mp4
commented

@rubensworks I will test shortly and report back!

commented

Significantly better! Previously I was dropping below one frame per second. Now I lose about fifteen frames per second, so dropping from sixty to forty five. I'm not sure if one of this family of mods is responsible for that, though, or if it's just a normal performance hit from being in a UI. I have noticed a performance hit to being in any UI so I'm inclined to think this family of mods is not at fault for that.

commented

Excellent, thanks for checking @Snonky and @glektarssza.
Closing this issue then.

@Snonky I'll try to review your PR in CyclopsMC/IntegratedTerminals-Compat#8 later this week!