Snappy (compression)
Snappy (previously known as Zippy) is a fast data compression and decompression library written in C++ by Google based on ideas from LZ77 and open-sourced in 2011.[src] It does not aim for maximum compression, or compatibility with any other compression library; instead, it aims for very high speeds and reasonable compression.[src] Compression speed is 250 MB/s and decompression speed is 500 MB/s using a single core of a circa 2011 "Westmere" 2.26 GHz Core i7 processor running in 64-bit mode.[src] The compression ratio is 20–100% lower than gzip.[src] Snappy is widely used in Google projects like Bigtable, MapReduce and in compressing data for Google's internal RPC systems.[src] It can be used in open-source projects like MariaDB ColumnStore, Cassandra, Couchbase, Hadoop, LevelDB, MongoDB, RocksDB, Lucene, Spark, Parquet, InfluxDB, and Ceph.[src] Firefox uses Snappy to compress data in localStorage.[src] Decompression is tested to detect any errors in the compressed stream.[src] Snappy does not use inline assembler (except some optimizations ) and is portable.[src]
Snappy (previously known as Zippy) is a fast data compression and decompression library written in C++ by Google based on ideas from LZ77 and open-sourced in 2011.[src] It does not aim for maximum compression, or compatibility with any other compression library; instead, it aims for very high speeds and reasonable compression.[src] Compression speed is 250 MB/s and decompression speed is 500 MB/s using a single core of a circa 2011 "Westmere" 2.26 GHz Core i7 processor running in 64-bit mode.[src] The compression ratio is 20–100% lower than gzip.[src] Snappy is widely used in Google projects like Bigtable, MapReduce and in compressing data for Google's internal RPC systems.[src] It can be used in open-source projects like MariaDB ColumnStore, Cassandra, Couchbase, Hadoop, LevelDB, MongoDB, RocksDB, Lucene, Spark, Parquet, InfluxDB, and Ceph.[src] Firefox uses Snappy to compress data in localStorage.[src] Decompression is tested to detect any errors in the compressed stream.[src] Snappy does not use inline assembler (except some optimizations ) and is portable.[src] The stream starts with the length of the uncompressed data as a varint, so the first byte, with the high bit clear, corresponds to a length of 51 16 =81 bytes.[src] The first block must be a literal, and f042 corresponds thereto: the first byte is broken down as f0 16 ⇒ len−1=111100 2 ;type=00 2 ; type 0 signifies a literal, and a length−1 of 111100 2 =60 means the length is read from the following byte, in this case 42 16 =66.[src] The first 66 bytes of the text ("Wikipedia is a free, web-based, collaborative, multilingual encyclo") follow.[src] 000040 6e 63 79 63 6c 6f 09 3f 1c 70 72 6f 6a 65 63 74 >ncyclo.?.project .[src] 16 ⇒ off h =000 2 ,len−4=010 2 ;type=01 2 : type 1 indicates a "copy with 1-byte offset": the length to copy works out to 010 2 +4=6 bytes, and the offset is an 11-bit integer whose top bits are off h and whose low bits are the next byte: 3f, so {off h }{3f 16 }=00000111111 2 =63.[src] This means to copy 6 bytes, starting 63 bytes ago – since 67 bytes have already been copied this evaluates to copying 6 bytes starting at position 4 (from the fifth byte), which produces "pedia ".[src] This block has no other content, and thus the following block starts immediately after – 1c 16 ⇒ len−1=000111 2 ;type=00 2 , i.e.[src] a literal of length 000111 2 +1=8.[src] The final part of the text ("project.") follows.[src] In this example, all common substrings with four or more characters were eliminated by the compression process.[src] More common compressors can compress this better.[src] Unlike compression methods such as gzip and bzip2, there is no entropy encoding used to pack alphabet into the bit stream.[src] ==External links== Snappy mailing list[src]
31 sentences · 31 cited inline · 0 references stored
References
No reference rows published for this article.
Cite this article
MLA
"Snappy (compression)." encyclopegia.org, 2025, https://encyclopegia.org/wiki/snappy-compression. Accessed 27 November 2026.
Chicago
"Snappy (compression)." encyclopegia.org. Accessed November 27, 2026. https://encyclopegia.org/wiki/snappy-compression.
APA
encyclopegia.org. (2025). Snappy (compression). Retrieved November 27, 2026, from https://encyclopegia.org/wiki/snappy-compression
Accessed November 27, 2026 · CC BY-SA 4.0 · citation page · JSON