BCPack: find a slot's bucket from a window table #93
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/93"
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 TG0000 on 2026-11-24T00:24:37Z.
The BCPack decoder (
crates/victory-formats/src/bcpack.rs, the DirectStorage texture unpack path) spends almost all of its time inLane::step, one rANS symbol at a time. This PR makes the per-symbol work cheaper. The output stays the same.What changes
Tablesnow keeps one byte per 256-slot window per model (32 KiB, boxed, built inTables::parse): the bucket of the window's first slot.bucket_ofstarts there and steps over the few buckets that begin inside the window.startgets one more 65536 sentinel, so the step loop needs no length check.leading_zeros, a multiply, a mask).pos / per * stride + pos % per(a division by a runtime value) for every symbol.Measured
Synthetic streams with the synthetic test tables. No game data. Release build, one core, 16384 blocks, median of 3 runs, before and after on the same machine:
To reproduce:
cargo test --release -p victory-formats bcpack_throughput -- --ignored --nocaptureTests
bucket_lookup_matches_a_scan_of_the_starts: the window lookup against the old scan, for every slot of every model, on the shipped tables, on the uniform synthetic tables and on tables with one-slot buckets.payload_step_matches_the_reference_decode: a payloadLane::stepagainst the first version's arithmetic (scan plus division), on the shipped tables and the synthetic ones, for every model and slot at three state heights.every_layout_round_trips_through_the_lanes: all six format lane layouts at 1, 2, 17, 300 and 1000 blocks, with short and long fragments.bcpack_throughput(ignored): the benchmark above.What ran:
cargo test --workspaceandcargo xtask policypass, andclippy --workspace --all-targetsreports nothing new. I didn't run the ignoredreference_chunkstest, because it needs reference chunks from outside the repository. This is CPU-only code, so it wasn't run on a GPU or against the game.It touches only
bcpack.rs, which no open PR touches.AI-assisted (Claude Code).
🤖 Generated with Claude Code
Imported from Marvisak/VIctory. Originally posted by DaviTostes on 2026-11-24T01:12:05Z.
Tested
3e982f7: pass.cargo test -p victory-formats: 20 passed, 0 failed, 4 ignored, including the 4 tests this PR adds.No game data used.