Add generic sparse set - #455
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8442c9c800
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
|
Codex Review: Didn't find any major issues. Swish! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3ed319ef6d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
|
Codex Review: Didn't find any major issues. Breezy! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
SparseSet<T:>with O(1) membership, insertion, and unordered removalSparseSet<unit>PriorityQueue<T:>with focused testsPriority queue
PriorityQueue<T:>is a binary heap using the existingComparator<T>API.add/offerandpoll/removeare O(log n);peekis O(1). The comparator determines whether it behaves as a min-heap or max-heap. Tests cover duplicate priorities, both comparator directions, empty operations, clear/reuse, growth, and mixed insertion order.Benchmark
SparseSetBenchmarkuses conservative repeated timer workloads for membership, remove/re-add, and iteration. The remove/re-add section comparesHashSet<unit>,SparseSet<unit>, and the native WC3groupusing the same hidden paused units. Each phase cleans up its temporary state and waits 2.5 seconds before starting the next phase so FPS can recover.Start it in-game with
-sparsebench.Validation
grill typecheck --quietgrill test SparseSetTests --quietgrill test PriorityQueueTests --quietgrill test --quiet