Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1.20.1] Having a lot of mods causes TC JEI loading to slow down to a crawl (~45 seconds to load) #5290

Open
carbonatek opened this issue Jan 1, 2025 · 11 comments
Labels
1.20 Issue affects 1.20 Bug Issue describes unintended or broken behavior Mod interaction Issue only happens when another mod is loaded

Comments

@carbonatek
Copy link

Minecraft Version

1.20.1

Modloader

Forge

Modloader Version

47.3.0

Mantle Version

1.11.28

Tinkers' Construct Version

3.9.0.6

Describe your issue

From what I understand, TC tries to automatically generate copper cans for each liquid in the game, crafting stations from some blocks in the game, and lanterns with liquids too. This is good, but, in large modpacks (in my case, about 200 mods add actual content but about 20 are responsible for most of the liquids), is quite the taxing endeavour;
[01Jan2025 10:54:49.206] [Render thread/INFO] [mezz.jei.library.ingredients.IngredientManager/]: Ingredients are being removed at runtime: 9807 net.minecraft.world.item.ItemStack
Note that this does not entirely comprise from Copper Can recipes being removed, Copper Cans represent only about 1116 of those items, rest of which are generated scorched/seared lanterns, fuel tanks and fuel gauges.
In terms of Crafting Stations, there's about 800 of them, same seems to be with Part Builders. It seems they try to load Chipped blocks though, which is kind of brutal.

Time aftermath: [01Jan2025 10:55:34.326] [Render thread/INFO] [mezz.jei.library.load.PluginCallerTimerRunnable/]: Sending Runtime: tconstruct:jei_plugin took 45.12 seconds

Provided the entire log in the crash report.
Interestingly enough, despite spamming the log so much, there are no copper cans in JEI anyway, so what's this all about?

Crash Report

https://gist.github.com/carbonatek/f01663a28515fdb67b97363ddebb94a2

Other mods

I have not tried it with less mods, because obviously, it would load faster.
Major liquid providers (as in, they provide a lot of liquids, sorted by amount) in the modpack:

  • GTCEu Modern
  • NuclearCraft
  • Tech Reborn
  • Mekanism

Tried reproducing with just Tinkers?

No

Performance Enchancers

Rubidium/Embeddium

Searched for known issues?

Searched open issues

@carbonatek carbonatek added Bug Issue describes unintended or broken behavior Unreviewed Issue is new and is awaiting the team to review it labels Jan 1, 2025
@embeddedt
Copy link

Can you start a Spark profile running on the client with /sparkc profiler start and then run /reload? This should capture the JEI reloading process in the Spark profile. Once the reload finishes (you'll know from the log because you will see JEI reload as well) stop the profile and share the link.

@carbonatek
Copy link
Author

Here's the spark profile:
https://spark.lucko.me/NFvVxJD5gk

@KnightMiner
Copy link
Member

What happens if you change the client config to show everything?

Basically, JEI in 1.20 no longer supports me not adding something to JEI that's in creative. My only choice that doesn't break my own creative tabs is to remove the content from JEI after the fact. I'm assuming the issue is not generating the list of its, but rather the remove at runtime in JEI being unoptimized

@carbonatek
Copy link
Author

Hm, I had low memory search enabled because the modpack is kind of hardware taxing and I don't want it to be more taxing than it needs.
Disabled it and now it loads fine?
[16:24:38] [Render thread/INFO] [me.je.li.lo.PluginCallerTimerRunnable/]: Registering recipes: tconstruct:jei_plugin took 425.0 milliseconds
This looks like a regression on JEI's side because low memory slow search should not impact this SO hard?

@KnightMiner
Copy link
Member

KnightMiner commented Jan 1, 2025

Well, there shouldn't be 8000 items being removed at runtime.

I'll see if there is a way I can detect from the creative tab builder that we are in JEI which would make this notably faster

@embeddedt
Copy link

I believe JEI implements ingredient removal by searching for each one and then removing it if found. If low memory search is used, each search takes time proportional to the total number of ingredients, which means removals will become much slower than with regular search.

@KnightMiner KnightMiner added Mod interaction Issue only happens when another mod is loaded and removed Unreviewed Issue is new and is awaiting the team to review it labels Jan 2, 2025
@KnightMiner
Copy link
Member

Here's the spark profile: https://spark.lucko.me/NFvVxJD5gk

Took a quick look at this profile, seems that equal to the time we spend removing ingredients is the time Create spends adding spout recipes. Which is likely due to their look over every single item in JEI and loading its capabilities (capabilities are slow in Forge).

Did the issue entirely go away when you changed that config option? I suppose that may be causing latency during a different point in your world startup.

Hm, I had low memory search enabled because the modpack is kind of hardware taxing and I don't want it to be more taxing than it needs. Disabled it and now it loads fine? [16:24:38] [Render thread/INFO] [me.je.li.lo.PluginCallerTimerRunnable/]: Registering recipes: tconstruct:jei_plugin took 425.0 milliseconds This looks like a regression on JEI's side because low memory slow search should not impact this SO hard?

Low memory search probably means they throw away any search related data structures after searching instead of saving them for the next search. Saves you RAM at the cost of every search operation taking more time.

@KnightMiner
Copy link
Member

KnightMiner commented Jan 3, 2025

I've looked into this issue further and just don't see an alternative to my current approach of removing ingredients at runtime. I believe I'll need a new JEI hook if I wanted to do anything; some sort of "should I add ingredient from your creative tab" hook. Alternatively, if JEI just passed in something I can recognize as part of the creative tab builder parameters I could condition off that; e.g. a particular fake feature flag I can look for.

Such a hook would probably also help Create's plugin go faster as there are not a ton of fluid items added to the item list now (though I'd still advise against resolving capabilities on every single stack...)

Can you crosspost this issue to JEI's issue tracker?

@carbonatek
Copy link
Author

carbonatek commented Jan 3, 2025

Here's the spark profile: https://spark.lucko.me/NFvVxJD5gk

Took a quick look at this profile, seems that equal to the time we spend removing ingredients is the time Create spends adding spout recipes. Which is likely due to their look over every single item in JEI and loading its capabilities (capabilities are slow in Forge).

Did the issue entirely go away when you changed that config option? I suppose that may be causing latency during a different point in your world startup.

Hm, I had low memory search enabled because the modpack is kind of hardware taxing and I don't want it to be more taxing than it needs. Disabled it and now it loads fine? [16:24:38] [Render thread/INFO] [me.je.li.lo.PluginCallerTimerRunnable/]: Registering recipes: tconstruct:jei_plugin took 425.0 milliseconds This looks like a regression on JEI's side because low memory slow search should not impact this SO hard?

Low memory search probably means they throw away any search related data structures after searching instead of saving them for the next search. Saves you RAM at the cost of every search operation taking more time.

When I disabled Low Memory Search, the time has changed to about ~425ms for Tinkers' Construct but Create still takes that ridiculous amount of time. The only way I fixed the Create problem is by simply using "return" in the spout recipe function and commenting all the code, causing the recipes to not register at all, which does not bother me per se, but it's a bandaid fix for a problem of a larger scope.

EDIT: But indeed you're correct about the capabilities, because the snippet of code I commented calls Forge Capabilities about two times for each liquid, iirc. Not fluent in Java though so, don't expect any knowledge from me :-D

@carbonatek
Copy link
Author

carbonatek commented Jan 3, 2025

To add to this, I would be interested in how Immersive Engineering handles those recipes, because they've got recipes for filling all the liquids to a bucket in the game but it doesn't take nearly as much as Create does.

@KnightMiner
Copy link
Member

Most people.just iterate the item registry, not the JEI ingredient registry.

@KnightMiner KnightMiner added the 1.20 Issue affects 1.20 label Jan 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.20 Issue affects 1.20 Bug Issue describes unintended or broken behavior Mod interaction Issue only happens when another mod is loaded
Projects
None yet
Development

No branches or pull requests

3 participants