perf(formats): share XMA2 scale factor tables across voices #661
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/lobomfz--VIctory-xmem!661
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-661"
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?
@tevanc14 on GitHub · 2026-12-06 02:06 UTC · original
tevanc14:perf/xma-scale-factor-tables→main· +71 −40 · 1 files · 1 commits · openEvery active XMA2 voice constructs a decoder. The scale factor tables depend only on the normalized sample rate, but each decoder currently rebuilds and stores a copy. Compute the four layouts at compile time and share the immutable tables across decoders.
Benchmark
Compared
8c4e663withd0d81fbon Linux, Ryzen 5 7600X, Rust 1.98.1. Both builds ran the same harness with the production codec and the project's synthetic valid XMA2 stream generator. Rates were 24, 32, 44.1, and 48 kHz, with mono and stereo cases. The harness timed decoder construction followed by decoding one, eight, or 64 frames per voice, and measured reuse separately. Input generation and PCM allocation were outside timing. Built withrustc --edition 2024 --test -O -C codegen-units=1 -C lto=thin -C target-cpu=x86-64-v3and ran pinned withtaskset -c 4. Six trials per build, balanced in ABBA/BAAB/ABBA order.First-frame samples (µs/voice, paired in execution order):
First-frame time improved in five of six pairs. The steady decoding difference was within run-to-run variation. Decoder size on x86-64 fell from 14,304 to 11,480 bytes, saving 2,824 bytes per decoder and adding 11,328 bytes of shared read-only tables. This is a codec benchmark using generated audio. Game audio latency and FPS were outside its scope.
Checks
cargo xtask policypassed for 370 files.Also ran
cargo test --locked --release -p victory-formats(66 passed, nine ignored) on Linux and./build.sh checkfor the Windows build. Windows was compile-checked.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.