Skip to content

Dedupe updateLayout on first open#203

Open
Rsslone wants to merge 1 commit into
CleanroomMC:cleanroomfrom
Rsslone:subtypePerf
Open

Dedupe updateLayout on first open#203
Rsslone wants to merge 1 commit into
CleanroomMC:cleanroomfrom
Rsslone:subtypePerf

Conversation

@Rsslone
Copy link
Copy Markdown
Contributor

@Rsslone Rsslone commented May 11, 2026

A simple bool to dedupe the updateLayout call on open.

EDIT : This PR has been rewritten to remove the very flawed red herring I cased trying to fix an issue.

@Rsslone
Copy link
Copy Markdown
Contributor Author

Rsslone commented May 11, 2026

Fixes #202

Copy link
Copy Markdown

@jchung01 jchung01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

StackHelper#uidCache is cleared after startup because it takes up a lot of memory. I verified this in the MeatballCraft modpack - with this PR, uidCache retains 473 MB. I think your 1st commit should be reverted, this seems unacceptable regardless of ultra-low memory mode.

Having no UID cache at runtime should be fine in most cases, it was only having performance issues with the anvil category because all possible itemstacks were being condensed into a single anvil entry per unique enchantment, so the LHS input and output ingredient lists were extremely large, causing the slowdown while querying the UID. As I mentioned in the issue, that only seems to be happening with the published version of 4.31.1 (for unknown reasons), but not one built off the current main branch.

open();
}
} finally {
openingGui = false;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this in a try-finally block?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To ensure it always gets set back to false, is it actually a concern? I don't know.

open();
}
} finally {
openingGui = false;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this in a try-finally block?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To ensure it always gets set back to false, is it actually a concern? I don't know.

@Rsslone Rsslone marked this pull request as draft May 12, 2026 23:03
@Rsslone
Copy link
Copy Markdown
Contributor Author

Rsslone commented May 12, 2026

StackHelper#uidCache is cleared after startup because it takes up a lot of memory. I verified this in the MeatballCraft modpack - with this PR, uidCache retains 473 MB. I think your 1st commit should be reverted, this seems unacceptable regardless of ultra-low memory mode.

Having no UID cache at runtime should be fine in most cases, it was only having performance issues with the anvil category because all possible itemstacks were being condensed into a single anvil entry per unique enchantment, so the LHS input and output ingredient lists were extremely large, causing the slowdown while querying the UID. As I mentioned in the issue, that only seems to be happening with the published version of 4.31.1 (for unknown reasons), but not one built off the current main branch.

I agree, this might have been me following a red herring, it makes sense why I was struggling to find the cause now. I'll leave this as a draft until I can revert that commit so it doesn't merged.

@Rsslone Rsslone changed the title Keep built maps after load & dedupe updateLayout on first open Dedupe updateLayout on first open May 13, 2026
@Rsslone Rsslone marked this pull request as ready for review May 13, 2026 04:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants