Skip to content

perf(shader): flat open-addressing cache in the SRT evaluator - #421

Closed
MichonGoddijn231849 wants to merge 1 commit into
boykopovar:mainfrom
MichonGoddijn231849:perf/srt-evaluator-flat-cache
Closed

MichonGoddijn231849 wants to merge 1 commit into
boykopovar:mainfrom
MichonGoddijn231849:perf/srt-evaluator-flat-cache

Conversation

@MichonGoddijn231849

Copy link
Copy Markdown
Contributor

What

The SRT resource walk memoizes the value of every IR instruction it evaluates, so each value is computed once per capture. The memo was a std::unordered_map<IrValue*, std::uint64_t>, which allocates a node per value and hashes through the standard library. It is now a small open-addressing table: power-of-two slots keyed by the value pointer, growing at 75% load. No per-value allocation, and the same results.

Tested

Windows 11 Pro, AMD Ryzen 5 7600, NVIDIA GeForce RTX 5080 (driver 32.0.16.1074), 32 GB DDR5-5600, MinGW-w64 GCC 15.2.0.

  • ctest: all tests pass.
  • GTA V (PPSA04264), Prologue, APS5_PROFILE_DRAW=1: the capture walk dropped from 6.7 to 4.4 µs per capture, at about 190k captures per 10 s. Measured on my branch that combines this change with my other open PRs.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes. Written with Claude (Anthropic) under my direction; I reviewed and tested it.

🤖 Generated with Claude Code

The resource walk memoizes every evaluated IR value. An unordered_map allocated a node
per value; a power-of-two open-addressing table keyed on the value pointer does not.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@MichonGoddijn231849

Copy link
Copy Markdown
Contributor Author

Closing as a duplicate of #415, which does the same flat-table memo (and inlines the IrValue accessors on top). Sorry for the noise.

@MichonGoddijn231849
MichonGoddijn231849 deleted the perf/srt-evaluator-flat-cache branch October 9, 2026 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant