Look up rebuilt descriptor tables with a fast hash and an exact compare #34

Manually merged
github merged 1 commit from gh-pr/34/head into gh-pr/34/base 2026-11-26 03:34:08 +00:00
Owner

@⁠romainhedouin on GitHub · 2026-11-25 12:33 UTC · original
romainhedouin:perf/table-key → main · +64 −15 · 1 files · 1 commits · merged 2026-11-25 17:09 UTC

For each descriptor table it rebuilds, a draw first checks whether the list already built the same one, by hashing all its entries with SipHash. That is slow, and a hash collision would silently reuse the wrong descriptors. Now it uses a fast multiply-rotate hash and then compares the stored entries word for word: faster, and a collision now costs at most an extra copy, never wrong descriptors.

Per table, hash + lookup on a hit Before After
Model benchmark, 8 entries 132 ns 25 ns
Model benchmark, 16 entries 290 ns 66 ns
Model benchmark, 32 entries 564 ns 120 ns

"Model benchmark" = the same logic copied into a standalone program and timed in release mode on a Mac, not in the game. Type-checked for Windows (cargo clippy --target x86_64-pc-windows-msvc, with and without --all-features, no new warnings); not run. Touches State::tables like #33; whichever merges second needs a small rebase.

🤖 Generated with Claude Code

**@⁠romainhedouin** on GitHub · 2026-11-25 12:33 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/34) `romainhedouin:perf/table-key` → `main` · +64 −15 · 1 files · 1 commits · merged 2026-11-25 17:09 UTC For each descriptor table it rebuilds, a draw first checks whether the list already built the same one, by hashing all its entries with SipHash. That is slow, and a hash collision would silently reuse the wrong descriptors. Now it uses a fast multiply-rotate hash and then compares the stored entries word for word: faster, and a collision now costs at most an extra copy, never wrong descriptors. | Per table, hash + lookup on a hit | Before | After | |---|---|---| | Model benchmark, 8 entries | 132 ns | 25 ns | | Model benchmark, 16 entries | 290 ns | 66 ns | | Model benchmark, 32 entries | 564 ns | 120 ns | "Model benchmark" = the same logic copied into a standalone program and timed in release mode on a Mac, not in the game. Type-checked for Windows (`cargo clippy --target x86_64-pc-windows-msvc`, with and without `--all-features`, no new warnings); not run. Touches `State::tables` like #33; whichever merges second needs a small rebase. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:34:06 +00:00
github manually merged commit b41f3f3fde into gh-pr/34/base 2026-11-26 03:34:08 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.