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

Optimize spout recipe generation by avoiding filling non-empty items #7274

Merged

Conversation

embeddedt
Copy link
Contributor

Much of the time spent in Create's JEI plugin initialization is spent in SpoutCategory, where it iterates the entire list of JEI ingredients to generate filling recipes.

Most of the bottleneck is in getCapability as Forge fires an event for every single call (due to the item stacks being freshly constructed). The optimization here is to avoid the second getCapability call (that runs per registered fluid) by hoisting a check for whether the item could even be filled above the call. (We assume that a single-tank item cannot simultaneously be filled with two non-equal fluids.)

Another player and myself see a 7-10x improvement in the create:jei_plugin loading time with this change, tested on 1.20.1 with the following mods:

  • GTCEu Modern
  • NuclearCraft
  • Mekanism
  • Thermal
  • Tinkers' Construct
  • Create

An additional optimization would be to reduce the number of items being probed for capabilities, e.g. by iterating the item registry, instead of iterating the list of ingredients in JEI. I did not implement this as it would likely cause some edge case recipes to disappear.

@IThundxr IThundxr added the pr flag: simple PR has minimal changes label Jan 10, 2025
@IThundxr
Copy link
Member

IThundxr commented Jan 10, 2025

Thanks!

@IThundxr IThundxr merged commit abf0633 into Creators-of-Create:mc1.20.1/dev Jan 10, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr flag: simple PR has minimal changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants