Skip to content

Optimize BlockEntityTickersList#649

Open
HaHaWTH wants to merge 2 commits intover/1.21.11from
opt/te-tick-list
Open

Optimize BlockEntityTickersList#649
HaHaWTH wants to merge 2 commits intover/1.21.11from
opt/te-tick-list

Conversation

@HaHaWTH
Copy link
Member

@HaHaWTH HaHaWTH commented Feb 21, 2026

  1. Avoid cache miss by using IntArrayList.
  2. Since the TE iteration order is incremental, most marked indices are already sorted (maintain the isSorted flag just for defensive programming). This allows us to skip O(N) iteration and directly perform bulk removal.
  3. Use ReferenceArrayList as all implementations of TickBlockEntity are not overriding equals() and hashCode()

Tested with BlockEntityTickersListTest, passed integrity tests

1. Avoid cache miss by using IntArrayList.
2. Since the TE iteration order is incremental, most marked indices are already sorted (maintain `isSorted` flag just for defensive programming). This allows us to skip O(N) iteration and directly perform bulk removal.
3. Use ReferenceArrayList as all implementations of TickBlockEntity are not overriding equals() and hashCode()
HaHaWTH added a commit to HaHaWTH/SunBox that referenced this pull request Feb 24, 2026
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.

1 participant