Benchmark a standalone Rust backend for BCPack DDS batch export #805

Closed
opened 2026-11-23 06:55:25 +00:00 by wish131400 · 3 comments
wish131400 commented 2026-11-23 06:55:25 +00:00 (Migrated from github.com)
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by wish131400 on 2026-11-23T06:55:25Z.


Question

Would Xbox2Windows be interested in evaluating a standalone Rust backend for the batch exporter in #798? This follows up on the backend proposal in #458. The benchmark would exercise TTPF reading, BCPack decoding, DDS export, and manifest generation together.

Full-scale timing on the same PC

  • 2 min 28 s (147.55 s) for Rust-accelerated conversion and DDS writes on full-scale synthetic input. Eight Python workers invoked the Rust CPU decoder and block reconstruction code. The run wrote 51,156 DDS files (21.31 GB) across 55 pools with conversion work, with zero reported failures. Input generation took another 69.62 s.
  • 1 h 8 min 3 s (4,082.57 s) for the older Python-orchestrated CPU/GPU attempt on local pools. It used 12 workers across 57 pools and reported 51,150 of 51,156 DDS files complete.

Those runs used different inputs, worker counts, and timing boundaries. The standalone Rust executable has a separate same-input benchmark below. Its full-pool timing and a direct comparison against #798 remain open.

Evidence so far

The integration fixture in #798 stores already reconstructed BC1 and BC7 blocks as codec 0. It checks that the pinned Leonida exporter produces DDS files with the expected pixels. To exercise entropy decoding too, we can add a generated BC1 stream and a generated mode-6 BC7 stream to a minimal RDS5 pool, with independently specified block and pixel references. The source-built vectors and reference checks in #769 are a useful starting point for the BC7 case.

On Windows with a Ryzen 7 7700 and eight workers, our AI-assisted standalone prototype converted 8,192 pre-indexed synthetic BC1/BC7 textures with three mips each. Across three runs, median time was 5.051 s for standalone Rust and 7.317 s for our local Python orchestration with a Rust DLL. That is 31.0% less wall time, with matching DDS SHA-256 hashes for all 8,192 outputs per trial. The executable keeps decoded lane data in Rust buffers through reconstruction and schedules work on threads, avoiding Python list conversion, DLL marshaling and process-pool setup in that comparison.

Prior measurements and context are available in the Leonida proposal and the original benchmark comment.

Completion condition

  1. Run #798's pinned Leonida backend and the Rust candidate against the same generated RDS5 pool containing actual BCPack streams. Check the expected DDS block payloads and decoded pixels, plus a corrupt-stream rejection. Verify the strict-by-default behavior and the per-entry status and hashes in the manifest.
  2. Repeat on a larger generated batch with the same worker count and fresh output directories. Report timings from pool open through manifest publication, DDS counts and byte totals. Use the results to decide whether an optional Rust backend is worth integrating.

Required environment

Windows x64, Python for the reference backend, and a Rust release build. The comparison uses source-built inputs and CPU execution.

Checklist

  • The task can be reproduced with public or source-built inputs.
  • I did not include game files, dumps, distribution links or credentials.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6554012447 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/811). Originally posted by [wish131400](https://github.com/wish131400) on 2026-11-23T06:55:25Z. --- ### Question Would Xbox2Windows be interested in evaluating a standalone Rust backend for the batch exporter in #798? This follows up on the backend proposal in #458. The benchmark would exercise TTPF reading, BCPack decoding, DDS export, and manifest generation together. ### Full-scale timing on the same PC - **2 min 28 s (147.55 s)** for Rust-accelerated conversion and DDS writes on full-scale synthetic input. Eight Python workers invoked the Rust CPU decoder and block reconstruction code. The run wrote **51,156 DDS files (21.31 GB)** across 55 pools with conversion work, with zero reported failures. Input generation took another 69.62 s. - **1 h 8 min 3 s (4,082.57 s)** for the older Python-orchestrated CPU/GPU attempt on local pools. It used 12 workers across 57 pools and reported **51,150 of 51,156 DDS files complete**. Those runs used different inputs, worker counts, and timing boundaries. The standalone Rust executable has a separate same-input benchmark below. Its full-pool timing and a direct comparison against #798 remain open. ### Evidence so far The integration fixture in #798 stores already reconstructed BC1 and BC7 blocks as codec 0. It checks that the pinned Leonida exporter produces DDS files with the expected pixels. To exercise entropy decoding too, we can add a generated BC1 stream and a generated mode-6 BC7 stream to a minimal RDS5 pool, with independently specified block and pixel references. The source-built vectors and reference checks in #769 are a useful starting point for the BC7 case. On Windows with a Ryzen 7 7700 and eight workers, our AI-assisted standalone prototype converted 8,192 pre-indexed synthetic BC1/BC7 textures with three mips each. Across three runs, median time was **5.051 s** for standalone Rust and **7.317 s** for our local Python orchestration with a Rust DLL. That is **31.0% less wall time**, with matching DDS SHA-256 hashes for all 8,192 outputs per trial. The executable keeps decoded lane data in Rust buffers through reconstruction and schedules work on threads, avoiding Python list conversion, DLL marshaling and process-pool setup in that comparison. Prior measurements and context are available in the [Leonida proposal](https://github.com/ItsNotRexed/Leonida/issues/4949) and the [original benchmark comment](https://github.com/R0Y00/Xbox2Windows/issues/458#issuecomment-7093654321). ### Completion condition 1. Run #798's pinned Leonida backend and the Rust candidate against the same generated RDS5 pool containing actual BCPack streams. Check the expected DDS block payloads and decoded pixels, plus a corrupt-stream rejection. Verify the strict-by-default behavior and the per-entry status and hashes in the manifest. 2. Repeat on a larger generated batch with the same worker count and fresh output directories. Report timings from pool open through manifest publication, DDS counts and byte totals. Use the results to decide whether an optional Rust backend is worth integrating. ### Required environment Windows x64, Python for the reference backend, and a Rust release build. The comparison uses source-built inputs and CPU execution. ### Checklist - [x] The task can be reproduced with public or source-built inputs. - [x] I did not include game files, dumps, distribution links or credentials.
R0Y00 commented 2026-11-24 06:49:04 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T07:12:50Z.


A standalone benchmark is welcome. Use #798 and its pinned Leonida revision as the reference. Please publish the generated BC1 and mode-6 BC7 stream inputs, expected block bytes and decoded pixels, and the corrupt-stream control. For the timing run, use the same input, output scope and worker count, with fresh output directories and pool-open through manifest-publication timing. Include each run's DDS count, byte total, manifest status and hashes. We can evaluate optional integration once that comparison is reproducible.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7094097730 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/811#issuecomment-7094097730). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-23T07:12:50Z. --- A standalone benchmark is welcome. Use #798 and its pinned Leonida revision as the reference. Please publish the generated BC1 and mode-6 BC7 stream inputs, expected block bytes and decoded pixels, and the corrupt-stream control. For the timing run, use the same input, output scope and worker count, with fresh output directories and pool-open through manifest-publication timing. Include each run's DDS count, byte total, manifest status and hashes. We can evaluate optional integration once that comparison is reproducible.
wish131400 commented 2026-11-24 06:49:04 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by wish131400 on 2026-11-23T07:42:10Z.


@R0Y00 I ran the generated-stream benchmark against #798 at 66669bb with its pinned Leonida revision b0befb4. Both backends took the same generated RDS5 pool with 1,024 single-mip BC1 and mode-6 BC7 textures, used eight workers in strict mode and wrote to fresh output directories on the same NTFS volume. The timer covers pool open through manifest publication, including DDS SHA-256 calculation.

Trial #798 with pinned Leonida Standalone Rust
1 15.350 s 0.568 s
2 15.377 s 0.553 s
3 15.079 s 0.562 s
Median 15.350 s 0.562 s

Each backend produced 1,024 strict successes and 4,345,856 DDS bytes in every trial. All 1,024 file hashes and all manifest fields matched. For the 4×4 controls, both backends matched the expected block bytes and independently decoded RGBA8 pixels. Both rejected the truncated BC7 stream and exported its valid BC1 sibling. The rejected row has no file or hash in either manifest. The Python wrapper reports the failure in the manifest and returns exit 0. The Rust adapter returns exit 1.

The reproduction bundle contains the generator, pinned commands, generated streams and pools, expected block bytes and pixels, Rust source, and the per-run manifests. This measures the strict single-tile BC1/BC7 workflow on generated inputs. Real-pool throughput and calibrated multi-mip coverage still need direct measurement.

Reproduction bundle and results

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7094610839 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/811#issuecomment-7094610839). Originally posted by [wish131400](https://github.com/wish131400) on 2026-11-23T07:42:10Z. --- @R0Y00 I ran the generated-stream benchmark against #798 at `66669bb` with its pinned Leonida revision `b0befb4`. Both backends took the same generated RDS5 pool with 1,024 single-mip BC1 and mode-6 BC7 textures, used eight workers in strict mode and wrote to fresh output directories on the same NTFS volume. The timer covers pool open through manifest publication, including DDS SHA-256 calculation. | Trial | #798 with pinned Leonida | Standalone Rust | | --- | ---: | ---: | | 1 | 15.350 s | 0.568 s | | 2 | 15.377 s | 0.553 s | | 3 | 15.079 s | 0.562 s | | Median | **15.350 s** | **0.562 s** | Each backend produced **1,024 strict successes and 4,345,856 DDS bytes** in every trial. All 1,024 file hashes and all manifest fields matched. For the 4×4 controls, both backends matched the expected block bytes and independently decoded RGBA8 pixels. Both rejected the truncated BC7 stream and exported its valid BC1 sibling. The rejected row has no file or hash in either manifest. The Python wrapper reports the failure in the manifest and returns exit 0. The Rust adapter returns exit 1. The reproduction bundle contains the generator, pinned commands, generated streams and pools, expected block bytes and pixels, Rust source, and the per-run manifests. This measures the strict single-tile BC1/BC7 workflow on generated inputs. Real-pool throughput and calibrated multi-mip coverage still need direct measurement. [Reproduction bundle and results](https://gist.github.com/wish131400/41e2c73bccf284bc7f58214ab788b665) AI-assisted.
R0Y00 commented 2026-11-24 06:49:06 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T09:24:16Z.


The same-input benchmark in #811 is complete. The pinned #798 reference and standalone Rust produced matching 1,024 DDS hashes, byte counts and manifests, with independent BC1/BC7 pixel controls and a rejected truncated stream. The result supports an optional backend. #822 is the separate integration of the Rust kernels into the existing Python exporter. Keep its timings separate from the standalone comparison and from real-pool throughput.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7096603522 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/811#issuecomment-7096603522). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-23T09:24:16Z. --- The same-input benchmark in #811 is complete. The pinned #798 reference and standalone Rust produced matching 1,024 DDS hashes, byte counts and manifests, with independent BC1/BC7 pixel controls and a rejected truncated stream. The result supports an optional backend. #822 is the separate integration of the Rust kernels into the existing Python exporter. Keep its timings separate from the standalone comparison and from real-pool throughput.
Sign in to join this conversation.
No labels
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.

Reference
R0Y00/Xbox2Windows#805
No description provided.