perf(gpu): skip full/non-fitting pool blocks and reuse shadow scratch buffers #53

Merged
ahmetbagci8 merged 1 commit from upstream-pr/53 into main 2026-12-01 17:46:00 +00:00
ahmetbagci8 commented 2026-12-01 16:52:27 +00:00 (Migrated from github.com)

Imported from edsuuu/VI-BR-PORT. Originally posted by ahmetbagci8 on 2026-12-01T16:52:27Z.


Towards #27 (lower per-frame CPU preparing cost).

Changes

  1. Pool::take_ripe() default path (crates/victory-gpu/src/pool.rs): Mirror the ullest branch by checking lock.room >= len and !block.no_fit.is_some_and(|(l, a)| len >= l && align >= a) before scanning free gaps, and recording lock.no_fit on failure (already cleared on
    ested()).
  2. Shadow::writing() (crates/victory-gpu/src/shadow.rs): Reuse a single
    est scratch Vec via std::mem::swap instead of allocating a new Vec on every pending range iteration, and break early when parts becomes empty.
  3. Shadow::copy_back_with() (crates/victory-gpu/src/shadow.rs): Hoist the was scratch Vec outside the per-piece loop instead of allocating up to 64 KiB per differing piece.

Verification

  • cargo test -p victory-gpu --lib -- pool::tests shadow::merge_tests (23 passed, 0 failed)
  • cargo clippy -p victory-gpu --tests (0 warnings)
  • cargo test -p xtask english (5 passed, 0 failed)
<!-- greyfinch-sync:edsuuu/VI-BR-PORT:issue:5590322420 --> Imported from [edsuuu/VI-BR-PORT](https://github.com/edsuuu/VI-BR-PORT/pull/53). Originally posted by [ahmetbagci8](https://github.com/ahmetbagci8) on 2026-12-01T16:52:27Z. --- Towards #27 (lower per-frame CPU preparing cost). ## Changes 1. **Pool::take_ripe() default path (crates/victory-gpu/src/pool.rs):** Mirror the ullest branch by checking lock.room >= len and !block.no_fit.is_some_and(|(l, a)| len >= l && align >= a) before scanning free gaps, and recording lock.no_fit on failure (already cleared on ested()). 2. **Shadow::writing() (crates/victory-gpu/src/shadow.rs):** Reuse a single est scratch Vec via std::mem::swap instead of allocating a new Vec on every pending range iteration, and break early when parts becomes empty. 3. **Shadow::copy_back_with() (crates/victory-gpu/src/shadow.rs):** Hoist the was scratch Vec<u8> outside the per-piece loop instead of allocating up to 64 KiB per differing piece. ## Verification - cargo test -p victory-gpu --lib -- pool::tests shadow::merge_tests (23 passed, 0 failed) - cargo clippy -p victory-gpu --tests (0 warnings) - cargo test -p xtask english (5 passed, 0 failed)
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
edsuuu/VI-BR-PORT!53
No description provided.