Skip to content

Make spritelist remove() and pop() more preformant#2624

Merged
einarf merged 3 commits intodevelopmentfrom
spritelist-remove-perf
Mar 28, 2025
Merged

Make spritelist remove() and pop() more preformant#2624
einarf merged 3 commits intodevelopmentfrom
spritelist-remove-perf

Conversation

@einarf
Copy link
Member

@einarf einarf commented Mar 28, 2025

  • pop should now be O(1) instead of O(N)
  • remove() should be ~3x faster

einarf added 2 commits March 28, 2025 21:06
Because the index buffer and spritelist share
the same index we only need to resolve the index
once. Removing by value in an array is a lot more
expensive than removing by value in a list.
@einarf einarf changed the title Spritelist remove perf Make spritelist remove() and pop() more preformant Mar 28, 2025
@einarf einarf marked this pull request as ready for review March 28, 2025 20:59
@einarf einarf merged commit ef757d1 into development Mar 28, 2025
8 checks passed
@einarf einarf deleted the spritelist-remove-perf branch March 28, 2025 21:12
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