Reuse the raw inflater across SGD5 records #2936

Open
github-bot wants to merge 1 commit from github-bot/gh-2936 into main AGit
Owner

@⁠Brazzo978 on GitHub · 2026-11-29 18:54 UTC · original
Brazzo978:perf/reuse-sgd5-inflate → main · +18 −1 · 1 files · 1 commits · open

What it changes

SGD5 records contain independent raw DEFLATE streams. Reuse one zlib-rs inflater per calling thread and reset its stream state before each record. This keeps the inflater's window allocation available for the next record. Each caller still owns its decoded output. The regression test decodes a truncated stream, then a valid stream and an empty stream on the same thread.

How it was tested

  • cargo test --locked --profile diag -p victory-game passed on Windows 10 22H2 with Rust 1.98.1 (MSVC target).
  • A CPU-only allocator probe on a Ryzen 7 5800X3D decoded the same synthetic 1,024-byte raw stream 1,000 times on one thread and checked the output on every call.
  • The baseline made 2,000 allocation calls and requested 48,576,000 bytes cumulatively.
  • With reuse, the probe made 1,001 allocation calls and requested 1,071,552 bytes cumulatively. This includes the inflater retained on the thread.
  • The probe measures allocation requests. End-to-end preload time and gameplay performance are outside this measurement.

Checked for overlap

  • Searched open pull requests by SGD5, raw DEFLATE and inflater reuse. #623 changes the separate DirectStorage decompression path.

Codex helped implement and review the change.

**@⁠Brazzo978** on GitHub · 2026-11-29 18:54 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2936) `Brazzo978:perf/reuse-sgd5-inflate` → `main` · +18 −1 · 1 files · 1 commits · open ## What it changes SGD5 records contain independent raw DEFLATE streams. Reuse one `zlib-rs` inflater per calling thread and reset its stream state before each record. This keeps the inflater's window allocation available for the next record. Each caller still owns its decoded output. The regression test decodes a truncated stream, then a valid stream and an empty stream on the same thread. ## How it was tested - `cargo test --locked --profile diag -p victory-game` passed on Windows 10 22H2 with Rust 1.98.1 (MSVC target). - A CPU-only allocator probe on a Ryzen 7 5800X3D decoded the same synthetic 1,024-byte raw stream 1,000 times on one thread and checked the output on every call. - The baseline made 2,000 allocation calls and requested 48,576,000 bytes cumulatively. - With reuse, the probe made 1,001 allocation calls and requested 1,071,552 bytes cumulatively. This includes the inflater retained on the thread. - The probe measures allocation requests. End-to-end preload time and gameplay performance are outside this measurement. ## Checked for overlap - [x] Searched open pull requests by SGD5, raw DEFLATE and inflater reuse. #623 changes the separate DirectStorage decompression path. Codex helped implement and review the change.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-29 18:56:55 +00:00
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2936/head:github-bot/gh-2936'
git switch 'github-bot/gh-2936'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2936'
git switch 'github-bot/gh-2936'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2936'
git switch 'github-bot/gh-2936'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2936'
git switch 'main'
git merge --squash 'github-bot/gh-2936'
git switch 'main'
git merge --ff-only 'github-bot/gh-2936'
git switch 'main'
git merge 'github-bot/gh-2936'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/trustno1-coder--VIctory-NVIDIA!2936
No description provided.