Repository navigation
Conversation
Titles stream thousands of 64 KiB zlib blocks through DirectStorage at start-up (the retail title tested: ~9 800 requests in its first load). miniz_oxide decoded them at 210-270 MB/s on an i5-9600K; zlib-rs decodes the same blocks at 410-515 MB/s (400 blocks cut from a game executable and a release xcl.exe, compressed at level 6, 20 passes, 3 rounds). The behaviour is unchanged: the output is limited to the destination or intermediate size, a wrong Adler-32, a cut stream or more output than the limit fail with E_ZLIB_DATA, a shorter stream is returned as it is (BCPack's lenient case), and bytes after the stream's end are ignored. Ruled out: libdeflate was faster still (540-685 MB/s), but its Rust binding is Apache-2.0 only, which GPL-2.0 does not allow. Decoding with miniz_oxide into an exact-size buffer instead of a growing Vec gave nothing measurable. zlib-rs is pure Rust, Zlib licence, no dependencies.
…) prologue and ON_QUEUE release cleanup
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
|
Independent test report from a Linux/NVIDIA machine (this is a test report, not a code PR). Tested (patch applied with
Not tested: Windows-native run, BCPack/BC7 paths (unchanged by this PR), and a long streaming soak. A caveat on the retail numbers: this machine's copy of the title's AI use: omp (DeepSeek V4.1 Flash 1017) ran the build, the test binary and the retail run and wrote this report. |
DirectStorage's zlib stage decodes with zlib-rs instead of miniz_oxide. Titles stream thousands of 64 KiB zlib blocks at start-up (the retail title I test: ~9 800 file requests in its first load, ~650 MB inflated), and zlib-rs decodes them about twice as fast. The behaviour does not change. Related: #661 speeds up only miniz_oxide's Adler-32 (5.7 %); this replaces the decoder in this path, so #661 would no longer matter for DirectStorage.
What is in it
crates/xcl/src/hle/dstorage.rs:inflate_zlib(src, limit)wrapszlib_rs::inflate::uncompress_slicewith the same rules as the miniz call it replaces (output limited to the destination or intermediate size, E_ZLIB_DATA on a wrong Adler-32, a cut stream or more output than the limit, a shorter stream returned as is for BCPack's lenient case, bytes after the stream's end ignored), plus a unit test of each rule.crates/xcl/Cargo.toml,Cargo.lock:zlib-rs0.5.5 (Zlib licence, pure Rust, no dependencies). The other miniz_oxide uses (shader packs, PNG, tests) are left as they are.Tested
RTX 3060 (driver 32.0.16.2101), i5-9600K, 32 GB, Windows 11 Pro 26300, Rust 1.98.0 MSVC; debug for the suite, release for timing and the title.
cargo test --workspace --no-fail-fast -- --test-threads=4: 859 passed, 0 failed, 42 ignored (mainc160d86: 858 / 0 / 42; the one more is the new test). SKIPPED:gpu_geometry_wave32_prefix_count_over_a_mask(no wave64),gpu_wave32_program_in_wave64_hardware(no wave64),heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows).Decode speed, release, 64 KiB blocks compressed at level 6, 20 passes × 3 rounds, all outputs checked against the input:
xcl.exe(38 % ratio)The same harness checked the edge cases on all decoders: trailing padding, bad Adler-32, a limit one byte short, a limit larger than the stream.
Retail title,
scripts/smoke.ps1 -Seconds 90, release builds, mainc160d86and this PR alternating, 9 runs after a warm-up: no crash or device removal in any run. On this title the start-up is not bound by inflate: in the runs that started fast, the first 9 000 requests completed at 12.3 / 12.9 s (main) and 13.0 / 11.9 s (PR). The title also has a slow start-up mode in both builds (first PresentX at 15–31 s instead of ~4 s), which makes frames and peak commit follow how far the title got rather than the build.Regression run
main (run 1, back to back with the PR's run 1):
PR:
Not tested
Ruled out: libdeflate decoded the same blocks faster (540–685 MB/s), but its Rust binding (
libdeflater) is Apache-2.0 only, which GPL-2.0 does not allow. Decoding with miniz_oxide into an exact-size buffer instead of a growing Vec gave nothing measurable (181–274 MB/s).AI use
🤖 Generated with Claude Code