feat(pathfinding): .swb format v7 per-chunk compression (#3a) (#2470)
## Summary Phase #3a, stacked on #2469. Compresses each chunk record independently with libdeflate (random access preserved). Trammel: 124.7 MB → 19.2 MB (−85%). ## Details - Whole-record framing `[u32 UncompressedLen][payload]`; records that don't shrink (tiny Uniform) are stored raw, detected as payload length == UncompressedLen. - Codec chosen by full-Trammel spike: libdeflate VeryHigh (16.5 MB, 1.83 µs/chunk decompress) over zstd L19/22 (17.4 MB) and managed Brotli q11 (16.4 MB) — best native ratio, fastest decompress, already the repo's packet codec (no new dependency). - Reuses cached thread-static bindings: `Deflate.Maximum` for bake, `Deflate.Standard` for reads. - Compression is bake-time only; decompression is one-time per chunk (LRU-cached). - Format v7; v6 files rejected and re-baked once. ## Tests v7 unit tests + the v6 suite run through the compression path; full pathfinding suite green; Release build clean.
This commit is contained in:
parent
94537f83f8
commit
c265bcbb5e
4 changed files with 255 additions and 15 deletions
|
|
@ -23,5 +23,13 @@ public static class Deflate
|
|||
[ThreadStatic]
|
||||
private static LibDeflateBinding _standard;
|
||||
|
||||
[ThreadStatic]
|
||||
private static LibDeflateBinding _maximum;
|
||||
|
||||
public static LibDeflateBinding Standard => _standard ??= new LibDeflateBinding();
|
||||
|
||||
// Best-ratio compressor. Construction allocates a native libdeflate compressor, so it is
|
||||
// cached per thread like Standard and reused. Decompression is level-independent, so the
|
||||
// decompress path can use either accessor. libdeflate is not thread-safe — hence ThreadStatic.
|
||||
public static LibDeflateBinding Maximum => _maximum ??= new LibDeflateBinding(LibDeflateCompressionLevel.VeryHigh);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue