Skip to content

Improve FluidIngredient::getStacks dedup performance#4715

Open
Mqrius wants to merge 1 commit intoGregTechCEu:1.20.1from
Mqrius:fluids-4
Open

Improve FluidIngredient::getStacks dedup performance#4715
Mqrius wants to merge 1 commit intoGregTechCEu:1.20.1from
Mqrius:fluids-4

Conversation

@Mqrius
Copy link
Contributor

@Mqrius Mqrius commented Mar 5, 2026

What

ObjectArrayList is O(n²) for .contains. Since Fluids have a meaningful identity, it's better to use a HashSet.
This only matters if there are FluidIngredients that use a (tag with) a large number of fluids.

Implementation Details

Change to HashSet

Outcome

O(n) dedup

How Was This Tested

Game compiles and runs

Potential Compatibility Issues

-

@Mqrius Mqrius requested a review from a team as a code owner March 5, 2026 14:58
@github-actions github-actions bot added the 1.20.1 label Mar 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant