perf(victory-gpu): reuse overlay PDH/UTF-16 buffers and harden frametime tests #420
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/420"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from LooperSalty/AnyXboxX. Originally posted by Lewandox on 2026-11-26T18:04:22Z.
Summary
Eliminates recurring heap allocations in the performance overlay (
overlay.rs) and adds overflow-safe interval timing, stack-buffered NVIDIA driver parsing, and regression tests forframetime.rs.Changes
overlay.rs— reusable PDH buffer & stack UTF-16 encoding:buf: Vec<u64>insideGpu3dsoGpu3d::percent(&mut self)reuses its PDH counter buffer across 500 ms samples instead of allocating a freshVec<u64>on every tick; addedDrop for Gpu3dto close the PDH query handle cleanly.with_utf16([u16; 128]withVec<u16>fallback) andGdi::measure_widesoGdi::measureavoids heap allocation for overlay lines andGdi::drawencodes UTF-16 once instead of twice.with_utf16(ASCII, Unicode, surrogate pairs, >128 fallback).frametime.rs— overflow safety, zero-format!driver parsing, & regression tests:as_micros() as u64truncation intick()with saturatingu64::try_from(...).unwrap_or(u64::MAX)andsaturating_addaccounting.format!("{third}{fourth}")andStringdigit collection innvidia_driver_number()using a 5-byte rolling stack buffer.summarize_intervalandformat_rowand added comprehensive unit tests covering zero/single/spike intervals,u64::MAXsaturation, NVIDIA driver parsing edge cases, and CSV column-count parity againstHEADER.Verification
cargo test -p victory-gpu --lib overlay::tests(default and--features diagnostics)cargo test -p victory-gpu --lib frametime::tests(default and--features diagnostics)cargo xtask policy