perf(resource): gate filler-twins statistics behind diagnostics #13

Manually merged
github merged 1 commit from github-bot/gh-13 into gh-pr/13/base 2026-11-27 01:30:27 +00:00 AGit
Owner

@⁠LucaruluDev on GitHub · 2026-11-27 00:41 UTC · original
LucaruluDev:perf/diagnostics-only-filler → main · +19 −6 · 1 files · 1 commits · merged 2026-11-27 01:10 UTC

Summary

Compile placed-texture filler statistics only when the diagnostics feature is enabled.

Non-diagnostic builds no longer maintain the raw-description set, acquire its mutex when filler tracking is needed, scan its entries, or update the twin counter.

Diagnostic builds preserve the existing counting logic and lock order. Functional texture cache keys and VICTORY_PLACED_FILLER behavior remain unchanged.

Synthetic benchmark results

Metric Before After
Sparse trace p95 52.9 µs 2.8 µs
Sparse trace p99 108.8 µs 5.5 µs
Repeated-request p95 23.1 µs 2.8 µs
Repeated-request p99 38.1 µs 4.8 µs
Repeated-request p50 0.2 µs 0.4 µs

A separate single-threaded allocation benchmark with 12,000 descriptions across 128 addresses recorded:

  • 1,605 fewer allocation calls.
  • 1,173,936 fewer retained allocator-requested bytes.

Validation

  • Workspace test results identical to the baseline.
  • GPU library tests with diagnostics: 381 passed, 0 failed, 34 ignored.
  • Windows compilation with and without diagnostics.
  • Application release and diag compilation.
  • Clippy comparison: same pre-existing victory-formats failure as the baseline.

Limitations

These are synthetic workloads. Sub-microsecond timings are sensitive to scheduling and clock resolution.

Real workload frequency, process memory savings and FPS improvements remain unmeasured.

Belobug/VIctory-Belobug-AMD#409 independently proposes the same compile-time gating alongside additional statistics and size-cache changes.

This PR is deliberately limited to the gating change.


AI-assisted research, implementation, benchmarking and review using Claude Code and Codex.

**@⁠LucaruluDev** on GitHub · 2026-11-27 00:41 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/13) `LucaruluDev:perf/diagnostics-only-filler` → `main` · +19 −6 · 1 files · 1 commits · merged 2026-11-27 01:10 UTC ## Summary Compile placed-texture filler statistics only when the `diagnostics` feature is enabled. Non-diagnostic builds no longer maintain the raw-description set, acquire its mutex when filler tracking is needed, scan its entries, or update the twin counter. Diagnostic builds preserve the existing counting logic and lock order. Functional texture cache keys and `VICTORY_PLACED_FILLER` behavior remain unchanged. ## Synthetic benchmark results | Metric | Before | After | |---|---:|---:| | Sparse trace p95 | 52.9 µs | 2.8 µs | | Sparse trace p99 | 108.8 µs | 5.5 µs | | Repeated-request p95 | 23.1 µs | 2.8 µs | | Repeated-request p99 | 38.1 µs | 4.8 µs | | Repeated-request p50 | 0.2 µs | 0.4 µs | A separate single-threaded allocation benchmark with 12,000 descriptions across 128 addresses recorded: - 1,605 fewer allocation calls. - 1,173,936 fewer retained allocator-requested bytes. ## Validation - [x] Workspace test results identical to the baseline. - [x] GPU library tests with diagnostics: 381 passed, 0 failed, 34 ignored. - [x] Windows compilation with and without diagnostics. - [x] Application release and diag compilation. - [x] Clippy comparison: same pre-existing victory-formats failure as the baseline. ## Limitations These are synthetic workloads. Sub-microsecond timings are sensitive to scheduling and clock resolution. Real workload frequency, process memory savings and FPS improvements remain unmeasured. ## Related work Belobug/VIctory-Belobug-AMD#409 independently proposes the same compile-time gating alongside additional statistics and size-cache changes. This PR is deliberately limited to the gating change. --- AI-assisted research, implementation, benchmarking and review using Claude Code and Codex.
texture_at's filler-twins tracking (PLACED_RAW, PLACED_TWINS, and the
per-call block in texture_at that takes PLACED_RAW's own mutex and scans
previously-seen raw descriptions at the same address) exists solely to
feed placed_filler_twins(), whose only caller is copystat::log_memory --
itself compiled only with feature = "diagnostics". A build without that
feature paid for the second mutex, the BTreeSet, and an O(seen-so-far)
scan on every placed-texture lookup (hit or miss) with no consumer for
the result.

Gates PLACED_RAW, PLACED_TWINS, placed_filler_twins(), the `raw` binding,
and the tracking block itself behind feature = "diagnostics". The
functional cache (PLACED_TEXTURES) and its key (`key`, built from
VICTORY_PLACED_FILLER the same way as before) are untouched -- this
candidate never reads or writes PLACED_TEXTURES.

Independently reviewed before implementing (see
research/reviews/OPTIMIZATION_CANDIDATE_B_REVIEW.md): re-ran the
existing experiments/optimization-validation/filler.rs equivalence
tests myself (6/6 pass, both configs), confirmed the eliminated block
has no path into the functional cache, confirmed no equivalent change
exists upstream (checked ZJOU 477c395a directly -- it gates only the
getter, not the producer -- and did a fresh PR search).

Verified after implementing: cargo test --workspace --locked (27 result
lines) and cargo test -p victory-gpu --features diagnostics --lib (381
tests) are byte-for-byte identical in pass/fail/ignored counts between
this branch and an unpatched origin/main worktree. cargo clippy, both
CI invocations (with and without --all-features), produce an identical
error set to the same unpatched worktree (a pre-existing, unrelated
victory-formats issue blocks the workspace-wide command in both).

Does not implement candidate A (incremental VIEWS census) or the shapes
segmentation candidate, per instruction. No game files used, no push,
no PR.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 00:42:55 +00:00
github-bot changed target branch from main to gh-pr/13/base 2026-11-27 01:30:26 +00:00
github manually merged commit 5b36758982 into gh-pr/13/base 2026-11-27 01:30:27 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.