compress is a Go package providing optimized implementations of multiple compression algorithms.
The package addresses the need for faster compression and decompression in Go applications by offering hand-optimized implementations across several formats. It includes pure Go implementations of zstandard and S2 compression, optimized deflate packages that serve as drop-in replacements for the standard library's gzip, zip, and zlib modules, and faster variants of snappy and LZW. The package also provides lower-level entropy encoding primitives like Huffman and FSE, Microsoft XPRESS decompression support, and HTTP middleware for efficient gzipped and zstd request handling. Performance improvements are achieved through assembly optimizations and algorithmic refinements, with build tags available to disable unsafe code or assembly when needed.
Developers should adopt this package when performance matters in compression-heavy workloads. The drop-in replacement modules for gzip, zip, zlib, snappy, and LZW allow adoption with minimal code changes while gaining speed improvements. S2 is positioned as a high-performance alternative to Snappy, and the zstandard implementation enables zstd support in pure Go without external dependencies. The gzhttp module suits applications that need efficient HTTP compression negotiation. The package maintains compatibility with the current Go version and two prior versions.
The project receives active maintenance with regular updates addressing performance enhancements, platform-specific optimizations including ARM64 assembly implementations, and bug fixes. Contributions span algorithm improvements, architecture-specific code generation, and standards compliance corrections such as RFC-compliant header parsing.