Skip to content

Add generic sparse set - #455

Merged
Frotty merged 9 commits into
masterfrom
perf-audit
Aug 2, 2026
Merged

Add generic sparse set#455
Frotty merged 9 commits into
masterfrom
perf-audit

Conversation

@Frotty

@Frotty Frotty commented Aug 2, 2026

Copy link
Copy Markdown
Member

Summary

  • add a typed new-generic SparseSet<T:> with O(1) membership, insertion, and unordered removal
  • support signed integer keys consistently
  • add a reusable unit key provider for SparseSet<unit>
  • add focused sparse-set behavior tests
  • add a comparator-driven generic binary-heap PriorityQueue<T:> with focused tests
  • add a manual in-game Lua benchmark comparing SparseSet, HashSet, and native group behavior

Priority queue

PriorityQueue<T:> is a binary heap using the existing Comparator<T> API. add/offer and poll/remove are O(log n); peek is 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

SparseSetBenchmark uses conservative repeated timer workloads for membership, remove/re-add, and iteration. The remove/re-add section compares HashSet<unit>, SparseSet<unit>, and the native WC3 group using 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 --quiet
  • grill test SparseSetTests --quiet
  • grill test PriorityQueueTests --quiet
  • grill test --quiet

@Frotty
Frotty marked this pull request as ready for review August 2, 2026 13:28

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread wurst/data/SparseSet.wurst Outdated
Comment thread wurst/data/SparseSet.wurst Outdated
@Frotty

Frotty commented Aug 2, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: cfcbff1cf4

ℹ️ 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".

@Frotty

Frotty commented Aug 2, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread wurst/data/SparseSet.wurst Outdated
@Frotty

Frotty commented Aug 2, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

Reviewed commit: 9002520786

ℹ️ 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".

@Frotty
Frotty merged commit d1afbc2 into master Aug 2, 2026
2 checks passed
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