perf(victory-gpu): optimize tile heap free-run tracking with VecDeque and in-place coalescing #414

Closed
github-bot wants to merge 1 commit from github-bot/gh-414 into main AGit
Owner

@⁠Lewandox on GitHub · 2026-11-26 17:57 UTC · original
Lewandox:perf/victory-gpu-merge-and-tiles → main · +173 −48 · 2 files · 1 commits · closed without merging

Summary

Rebased onto the #409 combined base (dropping the merge.rs portion, as merge.rs was removed in #409).

Optimizes victory-gpu/src/tiles.rs free-run tracking for levels-on-demand tile heaps:

  • Replaces Vec<(u32, u32)> + h.free.remove(0) (O(n) shift on every exhausted run) with a FreeRuns wrapper backed by VecDeque<(u32, u32)> for O(1) pop_front().
  • Maintains cached free_tiles incrementally inside FreeRuns on take() and give_back() (eliminating the O(n) .iter().map(...).sum() rescan in give_back()).
  • Coalesces returned runs in-place via make_contiguous() + sort_unstable() + two-pointer compaction without allocating a temporary Vec on every give_back().
  • Adds unit test tiles::tests::free_runs_tracks_count_and_coalesces_in_place covering fragmentation, multi-run take, O(1) count tracking, and full coalescing.

Verification

  • cargo test -p victory-gpu tiles::tests (default and --features diagnostics)
**@⁠Lewandox** on GitHub · 2026-11-26 17:57 UTC · [original](https://github.com/LooperSalty/AnyXboxX/pull/414) `Lewandox:perf/victory-gpu-merge-and-tiles` → `main` · +173 −48 · 2 files · 1 commits · closed without merging ## Summary Rebased onto the `#409` combined base (dropping the `merge.rs` portion, as `merge.rs` was removed in `#409`). Optimizes `victory-gpu/src/tiles.rs` free-run tracking for levels-on-demand tile heaps: - Replaces `Vec<(u32, u32)>` + `h.free.remove(0)` (O(n) shift on every exhausted run) with a `FreeRuns` wrapper backed by `VecDeque<(u32, u32)>` for O(1) `pop_front()`. - Maintains cached `free_tiles` incrementally inside `FreeRuns` on `take()` and `give_back()` (eliminating the O(n) `.iter().map(...).sum()` rescan in `give_back()`). - Coalesces returned runs in-place via `make_contiguous()` + `sort_unstable()` + two-pointer compaction without allocating a temporary `Vec` on every `give_back()`. - Adds unit test `tiles::tests::free_runs_tracks_count_and_coalesces_in_place` covering fragmentation, multi-run `take`, O(1) count tracking, and full coalescing. ## Verification - `cargo test -p victory-gpu tiles::tests` (default and `--features diagnostics`)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 17:57:56 +00:00
github-bot force-pushed github-bot/gh-414 from 484dab3243 to 59556ce87e 2026-11-26 19:12:19 +00:00 Compare
github-bot changed title from perf(victory-gpu): reuse merge plan buffers and optimize tile free-run tracking to perf(victory-gpu): optimize tile heap free-run tracking with VecDeque and in-place coalescing 2026-11-26 19:35:00 +00:00
github-bot force-pushed github-bot/gh-414 from 59556ce87e to eaec92e6a0 2026-11-26 19:35:00 +00:00 Compare
github-bot force-pushed github-bot/gh-414 from eaec92e6a0 to 3b368a6cae 2026-11-27 00:36:04 +00:00 Compare
github-bot closed this pull request 2026-11-27 00:36:04 +00:00
Author
Owner

@⁠LooperSalty on GitHub · 2026-11-26 23:09 UTC · original

Closing after #454 moved third_party/victory to the Vice-Tay base (TaynanGT/Vice-Tay a252348).

The file does not apply to the new base any more, and the change came without a measurement (rule 2 of AGENTS.md asks for one for performance work).

Thanks for the work. If you measure a gain on the new base, a new PR against main is welcome.

🤖 Closed by Claude Code on behalf of the maintainer

**@⁠LooperSalty** on GitHub · 2026-11-26 23:09 UTC · [original](https://github.com/LooperSalty/AnyXboxX/pull/414#issuecomment-7205297025) Closing after #454 moved `third_party/victory` to the Vice-Tay base (TaynanGT/Vice-Tay a252348). The file does not apply to the new base any more, and the change came without a measurement (rule 2 of AGENTS.md asks for one for performance work). Thanks for the work. If you measure a gain on the new base, a new PR against `main` is welcome. _🤖 Closed by [Claude Code](https://claude.com/claude-code) on behalf of the maintainer_

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.