Two-Phase Recipe Addition System - #3981
Merged
Merged
Conversation
TechLord22
marked this pull request as ready for review
September 27, 2025 05:10
jurrejelle
force-pushed
the
tc/recipe-db
branch
from
November 29, 2025 19:26
6e19c47 to
dab9311
Compare
jurrejelle
force-pushed
the
tc/recipe-db
branch
from
November 29, 2025 20:07
954bb44 to
7f1bc33
Compare
TechLord22
force-pushed
the
1.20.1-v8.0.0
branch
from
December 24, 2025 23:25
c7da202 to
1789629
Compare
jurrejelle
approved these changes
Jan 8, 2026
screret
added a commit
to screret/GregTech-Modern
that referenced
this pull request
Jul 31, 2026
1 task
YoungOnionMC
added a commit
that referenced
this pull request
Aug 9, 2026
Co-authored-by: YoungOnion <39562198+YoungOnionMC@users.noreply.github.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.