Skip to content

Improve FluidIngredient::getStacks dedup performance#4715

Merged
TarLaboratories merged 1 commit intoGregTechCEu:1.20.1from
Mqrius:fluids-4
Apr 17, 2026
Merged

Improve FluidIngredient::getStacks dedup performance#4715
TarLaboratories merged 1 commit intoGregTechCEu:1.20.1from
Mqrius:fluids-4

Conversation

@Mqrius
Copy link
Copy Markdown
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
@TarLaboratories TarLaboratories added type: refactor Suggestion to refactor a section of code Release: Patch - 0.0.X Smaller changes that either are bug fixes or very minor tweaks. labels Apr 17, 2026
@TarLaboratories TarLaboratories merged commit 6e2efdd into GregTechCEu:1.20.1 Apr 17, 2026
6 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1.20.1 Release: Patch - 0.0.X Smaller changes that either are bug fixes or very minor tweaks. type: refactor Suggestion to refactor a section of code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants