Google snappy in C for Linux Kernel
C Python Makefile Shell Other
Switch branches/tags
Nothing to show
Clone or download
zeevt Merge pull request #30 from fperrad/master
fix gcc 6.3.0 warnings by removing useless cast
Latest commit 68d5176 Aug 1, 2017
Failed to load latest commit information.
python move python toys Feb 28, 2012
testdata check for memeory leaks Mar 26, 2011
.gitignore add `make` byproduct to .gitignore Oct 15, 2014
Makefile This patch adds two new "make install" arguments: Oct 13, 2014
README Update URL of Google Snappy Aug 18, 2016
TODO set LD_LIBRARY_PATH Apr 18, 2011
block_compressor.c use 8kb work memory to compress 4kb pages, like google's code. Apr 20, 2011
block_compressor_benchmark.txt update userspace benchmarks Apr 30, 2011
cl_tester.c cl_tester -S d test failed on AArch64 when decompressing data without Jul 29, 2015
csnappy.h Fix issue #20 from zeevt/csnappy: include stdint.h Oct 15, 2014
csnappy_compat.h Sereal's csnappy Win32 fixes Feb 28, 2013
csnappy_compress.c Fix 64 bit big endian code path in decoder. Sep 26, 2014
csnappy_decompress.c fix gcc 6.3.0 warnings by removing useless cast Jul 31, 2017
csnappy_internal.h Sereal's csnappy Win32 fixes Feb 28, 2013
csnappy_internal_userspace.h endian.h and mingw (same as PR #27) Nov 11, 2015
debugfs_input.txt zram now uses headerless snappy streams to save 2 bytes and a few cpu… Apr 4, 2011
kernel_3_2_10.patch a current linux kernel patch Mar 13, 2012
snappy_tester.patch update snappy tester patch Feb 28, 2012
unaligned_arm.s ARM optimizations. There will be more. In particular ARMv6 has unalig… Mar 11, 2012
unaligned_test.c tester for ARM on android Mar 11, 2012
userspace_benchmark.txt update userspace benchmarks Apr 30, 2011
zram_benchmark.txt split zram benchmark from readme Apr 15, 2011 big endian fixes, courtesy of debian ppc qemu image Apr 6, 2011


Google Snappy, available at
is a compression library designed for speed rather than compression ratios.

It is not a new concept by far. The Linux kernel currently uses LZO as the
 default fast compressor. Snappy works faster, though achieves less compression.

Google's code is written in C with a lot of C++. Some of the more interesting
 features that rely on C++ appear to have been elided from the open source
 version of Snappy.

To get the codebase into a shape that can be accepted into the mainline
 Linux kernel and used with zram (
Being able to compress vmlinux and initrd with Snappy is a secondary goal.
Same for support in Squashfs and other parts of the kernel that currently
 support LZO.

I cut out or ported to plain ANSI C the necessary code and headers.
To cause less confusion, I call this project (and files) csnappy.
The API looks right, but I welcome comments.
The code *has* been tested in kernel-space using a patched zram and it works.

The code has been tested in a qemu emulating a PowerPC Mac and ARMv5TE running
 Debian Wheezy.

I also use an ARMv6 Android phone for testing.

Testing on other hardware or platforms is welcome.

Note: The userspace tester is a hack, as is the shared library.

Someone wrote a perl wrapper for csnappy:

Patch for upstream snappy tester is available: snappy_tester.patch
Patch for linux kernel is available: kernel_3_2_10.patch

Benchmark in userspace: userspace_benchmark.txt
Benchmark in kernel space with zram: zram_benchmark.txt