Skip to content

make collection lookups not slow#284

Closed
cantmediaus-design wants to merge 1 commit into
lambda-client:1.21.11from
cantmediaus-design:perf/collection-hashset-lookup
Closed

make collection lookups not slow#284
cantmediaus-design wants to merge 1 commit into
lambda-client:1.21.11from
cantmediaus-design:perf/collection-hashset-lookup

Conversation

@cantmediaus-design
Copy link
Copy Markdown

what

so the CollectionSetting was using a MutableList this whole time which means every contains() call was just going through the entire list one by one. switched it to LinkedHashSet so it actually does the lookup properly

also that stream().anyMatch() in fillBlockEntityRenderStates was kinda rough, it was scanning through every block entity for each outline target every frame. just threw em in a HashSet first now

why

xray was doing like millions of comparisons per chunk rebuild because isSelected() gets called for basically every block and it was linear scanning a list of ~39 entries each time. thats not great

test

ran the client, loaded a world, toggled stuff on and off, nothing exploded

CollectionSetting backing store changed from MutableList to LinkedHashSet
so contains() is O(1) instead of O(N). Replaced stream().anyMatch() with
pre-built HashSet in fillBlockEntityRenderStates.
@github-project-automation github-project-automation Bot moved this to Backlog in Kanban Apr 12, 2026
@cantmediaus-design cantmediaus-design closed this by deleting the head repository Apr 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

1 participant