perf(victory-gpu): use VecDeque for Queue::held and shrink drained buffers #424

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

@⁠Lewandox on GitHub · 2026-11-26 18:10 UTC · original
Lewandox:perf/queue-vecdeque-and-shrink-drained → main · +54 −9 · 1 files · 1 commits · closed without merging

Summary

Replaces O(N) front-removal with O(1) VecDeque popping and shrinks retained spike capacity on drained queue buffers (third_party/victory/crates/victory-gpu/src/queue.rs):

  1. O(1) queue pop in release_held:
    • Changes Queue::held from Mutex<Vec<Held>> to Mutex<VecDeque<Held>>, replacing held.remove(0) (which shifted every remaining Held item on every pop) with held.pop_front().
  2. Reclaim spike capacity once queues drain:
    • Shrinks Queue::held and WAITING down to a small warm cap when they drain empty after loading/async-submit bursts so peak Vec/VecDeque allocations are not retained permanently.
  3. Unit test:
    • Adds unit test verifying shrink_drained reclaims oversized drained capacity while keeping small warm buffers untouched.

Verification

  • cargo test -p victory-gpu --lib queue::tests (default and --features diagnostics)
  • cargo xtask policy inside third_party/victory
**@⁠Lewandox** on GitHub · 2026-11-26 18:10 UTC · [original](https://github.com/LooperSalty/AnyXboxX/pull/424) `Lewandox:perf/queue-vecdeque-and-shrink-drained` → `main` · +54 −9 · 1 files · 1 commits · closed without merging ## Summary Replaces O(N) front-removal with O(1) `VecDeque` popping and shrinks retained spike capacity on drained queue buffers (`third_party/victory/crates/victory-gpu/src/queue.rs`): 1. **O(1) queue pop in `release_held`**: - Changes `Queue::held` from `Mutex<Vec<Held>>` to `Mutex<VecDeque<Held>>`, replacing `held.remove(0)` (which shifted every remaining `Held` item on every pop) with `held.pop_front()`. 2. **Reclaim spike capacity once queues drain**: - Shrinks `Queue::held` and `WAITING` down to a small warm cap when they drain empty after loading/async-submit bursts so peak `Vec`/`VecDeque` allocations are not retained permanently. 3. **Unit test**: - Adds unit test verifying `shrink_drained` reclaims oversized drained capacity while keeping small warm buffers untouched. ## Verification - `cargo test -p victory-gpu --lib queue::tests` (default and `--features diagnostics`) - `cargo xtask policy` inside `third_party/victory`
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 18:16:38 +00:00
github-bot closed this pull request 2026-11-26 18:35:15 +00:00
Author
Owner

@⁠Lewandox on GitHub · 2026-11-26 18:28 UTC · original

Closing as duplicate: already included in #411.

**@⁠Lewandox** on GitHub · 2026-11-26 18:28 UTC · [original](https://github.com/LooperSalty/AnyXboxX/pull/424#issuecomment-7200511187) Closing as duplicate: already included in #411.

Pull request closed

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