Skip to content

perf: 1.21.9 roundabout collection - #399

Open
Vonr wants to merge 2 commits into
wisp-forest:1.21.9from
Vonr:perf/1219-roundabout-collection
Open

perf: 1.21.9 roundabout collection#399
Vonr wants to merge 2 commits into
wisp-forest:1.21.9from
Vonr:perf/1219-roundabout-collection

Conversation

@Vonr

@Vonr Vonr commented May 14, 2026

Copy link
Copy Markdown

No description provided.

@Noaaan

Noaaan commented May 14, 2026

Copy link
Copy Markdown
Member

What performance issue does this PR solve? Could you provide some description?
No need to do it twice for the 1.21 backport in #400

@Vonr

Vonr commented May 14, 2026

Copy link
Copy Markdown
Author

sure, basically every time an ItemStack is copied, this gets called and there are multiple issues.

  1. the stream usage is extremely inefficient when you can just grab the underlying keySet. 1.21.x does do it better with an ArrayList but even then it wasnt preallocating.
  2. sometimes the collection isnt even necessary, but it happened anyways because the null check was located inside the receiving function.

overall this leads to some fairly ugly profiles
image
image
image
image

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