GameInput: binary-search retained readings #3684
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3684"
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 Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-28T06:19:49Z.
GetNextReading and GetPreviousReading scanned every retained reading while holding the GameInput state mutex. Each device's history is already ordered by timestamp and sequence. This finds its nearest eligible reading with a binary search, then chooses among those candidates in the existing device and sequence order.
The regression test checks forward and backward traversal across two wrapped histories with shared timestamps. Eleven GameInput tests, strict HLE Clippy and the 191-file asset policy passed on Windows.
An optimized CPU fixture using the old and new search code matched all 49,872 generated queries. Median search time over 11 alternating runs was 521 to 114 ns at 32 readings per device and 3,535 to 166 ns at 256. This measures the search with synthetic inputs. It excludes locking, host polling and game frame time.
The history capacity and eviction rules stay the same in this PR. The 256-entry measurement is relevant to #3105.
Please retain the Git author on cherry-pick or rebase, or add
Co-authored-by: andrewpozdnakov7-jpg <[email protected]>if folding the change into another commit.AI-assisted with OpenAI Codex.
Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-28T06:22:30Z.
Windows CI passed at
d10b61e, including Clippy on both build configurations and the repository test job. The 49,872 synthetic comparisons and the lookup timings in the description apply to this head. The combined 256-entry history also passed all 13 GameInput tests. Combined results on #3105.The next step is maintainer review.
Please retain the Git author on cherry-pick or rebase, or add
Co-authored-by: andrewpozdnakov7-jpg <[email protected]>if folding this change into another commit.AI-assisted with OpenAI Codex.
Imported from Marvisak/VIctory. Originally posted by cloph-dsp on 2026-11-28T10:43:06Z.
Independent local verification (Windows, Rust 1.100.0/MSVC, no game data):
d10b61ef92450f8744a750b382c4a280f70c36c8, base/parent63bcca43c6a00a758510398fa43096ce7e4f7df0.cargo test --locked -p victory-hle --lib -- modules::gameinput::tests::relative_readings_walk_wrapped_histories_with_tied_timestamps --exact --test-threads=1 --quiet→ 1 passed, 0 failed, 152 filtered, exit 0.git grep -Ffor the test name on the base returned no match (test is new on this PR);git diff --check 63bcca4 HEADclean (1 file, +73/-15).CARGO_TARGET_DIR(never shared) withCARGO_BUILD_JOBS=2.AI-assisted (Hy4 flash).
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.