-
Notifications
You must be signed in to change notification settings - Fork 326
Two-Phase Recipe Addition System #3981
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6e19c47 to
dab9311
Compare
954bb44 to
7f1bc33
Compare
c7da202 to
1789629
Compare
jurrejelle
approved these changes
Jan 8, 2026
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
1.20.1
Feature Frozen
Content Slated for NEXT update during a testing-cycle. Effectively, do not merge with this update.
Release: Major - 0.X.0
Releases focused on Content, changes to gameplay; While maintaining mostly API stability.
Tests: Passed
Game Tests have passed on this PR
type: refactor
Suggestion to refactor a section of code
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What
Adds recipes into the trie in a two-phase system. This will reduce memory usage and provide a minor speed boost to recipe searching. It reduces memory usage by flattening all of the recipe inputs, and sorting them by frequency, then using that frequency index to sort each recipe's inputs and add them in sorted order. This means the biggest nodes will be at the root of the trie and the leaves will be the smallest, instead of an even distribution. This will lower the size of the maps overall in the trie by compacting all occurrences of ingredients into the same condensed region within the datastructure.
Implementation Details
I refactored and significantly cleaned up
GTRecipeLookup. It is now calledRecipeDB. I stopped exposing most of the internal implementation details ofGTRecipeLookupthat never should have been made available outside it.Outcome
Better performance.
Potential Compatibility Issues
Will cause code breakage. The majority of the time, the fix is changing
gtRecipeType.getLookup().find()togtRecipeType.db().find().Any addons using the internal implementation details of
GTRecipeLookupwere doing something very wrong, and there is no obvious migration path for them. They will need to figure out how to move to the actual API methods, or result to brittle unsupported mixins into GT code.