Skip to main content

Module cpu_zstd

Module cpu_zstd 

Source
Expand description

CPU zstd backend — GPU 非搭載環境向け究極の fallback、および test bed。

  • zstd crate (zstd-safe + zstd-sys、Apache-2.0 OR MIT) を使った直球実装
  • 圧縮処理は CPU 重量級なので tokio::task::spawn_blocking で別スレッドへ逃がす
  • production では nvCOMP より遅いが、機能 / wire 互換 test の常設レーンとして必須

Structs§

CpuZstd
CPU zstd codec。level は 1..=22 (zstd-22 は最大圧縮率、時間は長い)。

Functions§

compress_blocking
Sync compress sibling of decompress_blocking. Provided for symmetry — the browser side rarely compresses (it’s read-only), but having both halves keeps the API explainable and useful for offline tooling.
decompress_blocking
Sync, runtime-free decompress used by s4-codec-wasm (browser / WASM has no tokio runtime and no spawn_blocking). Same checks as the trait implementation: codec/size match, decompression-bomb cap at manifest.original_size + 1024, crc32c verify after.