adjust recipe input expected cache size dynamically #2331
Merged
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
Adjusts the ingredient cache size based on previously seen sizes. This will prevent re-hashing the hashset during game load, which will help with memory allocation and subsequent GC action during the game loading process.
This optimization is not targeting CPU or load time, only a reduction in memory allocations and subsequent cleaning.
The default value is enough to not requite a re-hash with base GT alone. This work will primarily see benefits in installations with addons and modpacks creating their own recipes. These benefits will carry forward from modpack development to end users by shipping an updated config file with a final expected cache size.
Implementation Details
This work utilizes the config file as a persistent data storage across game loads. This should maybe be broken out into a separate file with our own handling if desirable.
Outcome
Reduces potential memory allocations for subsequent game loads.