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

adjust recipe input expected cache size dynamically #2331

Merged
merged 4 commits into from
Apr 4, 2024

Conversation

TechLord22
Copy link
Member

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.

@TechLord22 TechLord22 requested a review from a team as a code owner December 31, 2023 18:48
@TechLord22 TechLord22 added the type: feature New feature or request label Dec 31, 2023
@ALongStringOfNumbers
Copy link
Contributor

Why use a config and not directly save to World Save Data. That way people will not accidentally delete the file, modpack makers don't have to worry about shipping the file, and it takes advantage of an existing implementation within MC instead of us having to write our own.

The only issue is that it will not be applied when first creating the world, but will have to wait until future joining of the world.

@TechLord22 TechLord22 merged commit 251a9ac into master Apr 4, 2024
3 checks passed
@TechLord22 TechLord22 deleted the tc-ingredient-cache-size branch April 4, 2024 23:17
ALongStringOfNumbers pushed a commit that referenced this pull request Apr 24, 2024
ALongStringOfNumbers pushed a commit that referenced this pull request May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants