Skip to content

Commit

Permalink
[new] Re-enable Snappy compressor
Browse files Browse the repository at this point in the history
Upstream safety issue has been resolved,
Ref. <airlift/aircompressor#183>.
  • Loading branch information
ptaoussanis committed Feb 25, 2024
1 parent 21416f9 commit c543a70
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/taoensso/nippy.clj
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@
compression/lz4-compressor
compression/lz4hc-compressor
#_compression/lzo-compressor
#_compression/snappy-compressor ; Can be unsafe
compression/snappy-compressor
compression/lzma2-compressor

encryption/encrypt
Expand Down
15 changes: 9 additions & 6 deletions src/taoensso/nippy/compression.clj
Original file line number Diff line number Diff line change
Expand Up @@ -201,13 +201,16 @@
See `taoensso.nippy-benchmarks` for detailed comparative benchmarks."
(LZMA2Compressor. 0))

(enc/def* snappy-compressor
"Default `Snappy` compressor:
- Compression ratio: `C` (0.58 on reference benchmark).
- Compression speed: `A+` (206 msecs on reference benchmark).
- Decompression speed: `B` (134 msecs on reference benchmark).
Good general-purpose compressor, favours speed.
See `taoensso.nippy-benchmarks` for detailed comparative benchmarks."
(SnappyCompressor. false))

(enc/def* ^:no-doc lz4hc-compressor
"Different LZ4 modes no longer supported, prefer `lz4-compressor`."
{:deprecated "v3.4.0-RC1 (2024-02-06)"}
(LZ4Compressor.))

(enc/def* ^:no-doc snappy-compressor
"Snappy compressor no longer recommended, prefer `lz4-compressor`.
Decompression can be unsafe against untrusted data!"
{:deprecated "v3.4.0-RC1 (2024-02-06)"}
(SnappyCompressor. false))
2 changes: 1 addition & 1 deletion test/taoensso/nippy_tests.clj
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@
(doseq [c [compr/zstd-compressor
compr/lz4-compressor
compr/lzo-compressor
#_compr/snappy-compressor ; Ref. <https://github.com/airlift/aircompressor/issues/183>
compr/snappy-compressor
compr/lzma2-compressor]]

(dotimes [_ 2e4]
Expand Down

0 comments on commit c543a70

Please sign in to comment.