snappy-tools
https://builds.sr.ht/~nabijaczleweli/snappy-tools
https://todo.sr.ht/~nabijaczleweli/snappy-tools  (report at <mailto:~nabijaczleweli/snappy-tools@todo.sr.ht>)
https://lists.sr.ht/~nabijaczleweli/snappy-tools <mailto:~nabijaczleweli/snappy-tools@lists.sr.ht>

I saw some "snappy framed data"-compressed files in my Firefox profile,
and there didn't seem to be a decompressor for them in Debian.
Upstream homepage at https://google.github.io/snappy/; you need libsnappy-dev to build.

snappy(1): Snappy compression and decompression with and without framing
usage: snappy    [-f]   data > snappy.sn|.sz
       snappy    [-f] < data > snappy.sn|.sz
       snappy -d [-i]          snappy.sn|.sz
       snappy -d [-i] <        snappy.sn|.sz
usage: unsnappy [-i]   snappy.sn|.sz
       unsnappy [-i] < snappy.sn|.sz

Manual available online at https://srhtcdn.githack.com/~nabijaczleweli/snappy-tools/blob/man/snappy-tools.pdf


Naturally, the snappy framing format requires CRC32Cing the data.
There is a hardware-accelerated implementation for SSE4.2-capable i386/amd64 hosts:
          soft       crc32q
  E5645   357 MiB/s  6598 MiB/s
  5800X3D 527 MiB/s 11085 MiB/s


Note that upstream's spiel is 250M/s compression and 500M/s decompression (on "an i7"),
and ~.55 of the ratio of gzip -1 for HTML:
  $ curl -SL https://github.com/google/snappy/ > data
  $ snappy data > /dev/null
  data: 286555 -> 81458 (28.43%)
  $ snappy -f data > /dev/null
  data: 286555 -> 81520 (28.45%)
  $ gzip -c1 data | wc -c
  58254                 (20%)
  $ lz4 -vc1 data > /dev/null
  *** LZ4 command line interface 64-bits v1.9.4, by Yann Collet ***
  Compressed 286555 bytes into 73853 bytes ==> 25.77%
  $ zstd -vc1 data > /dev/null
  data                 : 17.47%   (   280 KiB =>   48.9 KiB, /*stdout*\)


Speed testing on tmpfs on bookworm/E5645/DDR3-1600, which an i7 is very much not:
  $ while :; do cat data || break; done | head -c 100M > 100M
  $ hyperfine -N 'snappy 100M' 'snappy -f 100M' 'gzip -c1 100M' 'lz4 -c1 100M' 'zstd -c1 100M'
  Benchmark 1: snappy 100M
    Time (mean ± σ):     280.2 ms ±   5.7 ms    [User: 247.2 ms, System: 32.7 ms]
    Range (min … max):   269.8 ms … 288.2 ms    10 runs

  Benchmark 2: snappy -f 100M
    Time (mean ± σ):     296.3 ms ±   6.2 ms    [User: 272.4 ms, System: 23.6 ms]
    Range (min … max):   288.5 ms … 303.2 ms    10 runs

  Benchmark 3: gzip -c1 100M
    Time (mean ± σ):      1.737 s ±  0.014 s    [User: 1.715 s, System: 0.022 s]
    Range (min … max):    1.728 s …  1.777 s    10 runs

  Benchmark 4: lz4 -c1 100M
    Time (mean ± σ):     327.0 ms ±   6.4 ms    [User: 295.9 ms, System: 30.8 ms]
    Range (min … max):   320.3 ms … 334.6 ms    10 runs

  Benchmark 5: zstd -c1 100M
    Time (mean ± σ):     129.7 ms ±  13.2 ms    [User: 139.9 ms, System: 56.8 ms]
    Range (min … max):   107.1 ms … 162.2 ms    18 runs

  Summary
    'zstd -c1 100M' ran                                  775 MiB/s
      2.16 ± 0.22 times faster than 'snappy 100M'        356 MiB/s
      2.29 ± 0.24 times faster than 'snappy -f 100M'     337 MiB/s
      2.52 ± 0.26 times faster than 'lz4 -c1 100M'       305 MiB/s
     13.40 ± 1.36 times faster than 'gzip -c1 100M'       57 MiB/s


  $ hyperfine -N 'snappy -d 100M.sn' 'snappy -d 100M.sz' 'gzip -dc 100M.gz' 'lz4 -dc 100M.lz4' 'zstd -dc 100M.zst'
  Benchmark 1: snappy -d 100M.sn
    Time (mean ± σ):     211.8 ms ±   7.8 ms    [User: 133.4 ms, System: 78.1 ms]
    Range (min … max):   205.9 ms … 235.1 ms    14 runs

  Benchmark 2: snappy -d 100M.sz
    Time (mean ± σ):     151.6 ms ±   4.7 ms    [User: 142.9 ms, System: 8.4 ms]
    Range (min … max):   147.7 ms … 160.6 ms    18 runs

  Benchmark 3: gzip -dc 100M.gz
    Time (mean ± σ):     707.5 ms ±   6.1 ms    [User: 696.0 ms, System: 11.2 ms]
    Range (min … max):   701.0 ms … 718.0 ms    10 runs

  Benchmark 4: lz4 -dc 100M.lz4
    Time (mean ± σ):     135.5 ms ±   5.1 ms    [User: 122.2 ms, System: 13.0 ms]
    Range (min … max):   128.2 ms … 143.5 ms    23 runs

  Benchmark 5: zstd -dc 100M.zst
    Time (mean ± σ):      63.3 ms ±   6.6 ms    [User: 63.5 ms, System: 8.5 ms]
    Range (min … max):    54.1 ms …  75.0 ms    45 runs

  Summary
    'zstd -dc 100M.zst' ran                             1579 MiB/s
      2.14 ± 0.24 times faster than 'lz4 -dc 100M.lz4'   738 MiB/s
      2.40 ± 0.26 times faster than 'snappy -d 100M.sz'  659 MiB/s
      3.35 ± 0.37 times faster than 'snappy -d 100M.sn'  472 MiB/s
     11.18 ± 1.17 times faster than 'gzip -dc 100M.gz'   141 MiB/s


Speed testing on tmpfs on sid@2023-12-26/5800X3D/DDR4-3600, which is several i7s:
  $ hyperfine -N 'snappy 100M' 'snappy -f 100M' 'gzip -c1 100M' 'lz4 -c1 100M' 'zstd -c1 100M'
  Benchmark 1: snappy 100M
    Time (mean ± σ):     149.2 ms ±   1.4 ms    [User: 139.7 ms, System: 9.3 ms]
    Range (min … max):   147.3 ms … 152.7 ms    19 runs

  Benchmark 2: snappy -f 100M
    Time (mean ± σ):     159.4 ms ±   1.3 ms    [User: 148.2 ms, System: 10.6 ms]
    Range (min … max):   157.3 ms … 162.0 ms    18 runs

  Benchmark 3: gzip -c1 100M
    Time (mean ± σ):     720.1 ms ±   5.1 ms    [User: 706.6 ms, System: 12.4 ms]
    Range (min … max):   715.7 ms … 731.8 ms    10 runs

  Benchmark 4: lz4 -c1 100M
    Time (mean ± σ):     150.0 ms ±   1.1 ms    [User: 114.5 ms, System: 35.1 ms]
    Range (min … max):   147.9 ms … 151.7 ms    19 runs

  Benchmark 5: zstd -c1 100M
    Time (mean ± σ):      40.9 ms ±   0.7 ms    [User: 31.8 ms, System: 42.2 ms]
    Range (min … max):    39.6 ms …  43.7 ms    69 runs

  Summary
    zstd -c1 100M ran                                    2444 MiB/s
      3.65 ± 0.07 times faster than snappy 100M           670 MiB/s
      3.66 ± 0.07 times faster than lz4 -c1 100M          666 MiB/s
      3.89 ± 0.08 times faster than snappy -f 100M        627 MiB/s
     17.59 ± 0.33 times faster than gzip -c1 100M         138 MiB/s


  $ hyperfine -N 'snappy -d 100M.sn' 'snappy -d 100M.sz' 'gzip -dc 100M.gz' 'lz4 -dc 100M.lz4' 'zstd -dc 100M.zst'
  Benchmark 1: snappy -d 100M.sn
    Time (mean ± σ):      97.3 ms ±   1.2 ms    [User: 57.1 ms, System: 39.9 ms]
    Range (min … max):    94.7 ms … 101.2 ms    29 runs

  Benchmark 2: snappy -d 100M.sz
    Time (mean ± σ):      68.3 ms ±   1.1 ms    [User: 63.6 ms, System: 4.4 ms]
    Range (min … max):    64.9 ms …  70.3 ms    42 runs

  Benchmark 3: gzip -dc 100M.gz
    Time (mean ± σ):     336.1 ms ±   2.2 ms    [User: 331.2 ms, System: 3.2 ms]
    Range (min … max):   333.9 ms … 339.8 ms    10 runs

  Benchmark 4: lz4 -dc 100M.lz4
    Time (mean ± σ):      45.9 ms ±   0.5 ms    [User: 41.7 ms, System: 4.0 ms]
    Range (min … max):    45.4 ms …  47.6 ms    63 runs

  Benchmark 5: zstd -dc 100M.zst
    Time (mean ± σ):      13.1 ms ±   0.3 ms    [User: 10.8 ms, System: 2.2 ms]
    Range (min … max):    12.3 ms …  14.1 ms    230 runs

  Summary
    zstd -dc 100M.zst ran                               7633 MiB/s
      3.51 ± 0.08 times faster than lz4 -dc 100M.lz4    2178 MiB/s
      5.22 ± 0.14 times faster than snappy -d 100M.sz   1464 MiB/s
      7.43 ± 0.18 times faster than snappy -d 100M.sn   1027 MiB/s
     25.65 ± 0.56 times faster than gzip -dc 100M.gz     297 MiB/s


Release tarballs are signed with nabijaczleweli@nabijaczleweli.xyz
  (pull with WKD, but 7D69 474E 8402 8C5C C0C4  4163 BCFD 0B01 8D26 58F1).
аnd stored in git notes, as-if via the example program provided at
  https://man.sr.ht/git.sr.ht/#signing-tagsx27-tarballs
and are thus available on the refs listing/tag page as .tar.gz.asc.
