A quick note for snappy users out there: we've recently completed a revamp of 
our [snappy implementation](https://github.com/status-im/nim-snappy), 
simplifying the API and making sure performance is decent.

The implementation covers both the plain and 
[framing](https://github.com/google/snappy/blob/main/framing_format.txt) 
formats, and offers implementations for both in-memory and streaming - framing 
+ streaming in particular allows keeping memory usage in check.

Compression and decompression is done either with user-supplied buffers (this 
API is completely dynamic-allocation-free), or via convenience functions:
    
    
    import snappy
    let
      compressed = snappy.encode([byte 0, 1, 2, 3])
      original = snappy.decode(compressed)
    
    
    Run

Performance-wise, there are benchmarks posted - generally on par with the 
faster implementations out there 
(<https://github.com/status-im/nim-snappy#performance>) - ie one could 
certainly do better with hand-written assembler like the go implementation 
does, but pure-nim is not bad either, even with the additional range-checking 
that Nim does.

The implementation was originally written by @jangko, and has since been 
audited, battle-tested and hardened via our (quite heavy) use of snappy 
throughout the Ethereum protocol space.

Have fun! 

Reply via email to