snappy

Google's Go implementation of the Snappy compression format, with assembly-accelerated block and streaming compression.

Library
Go
vv1.0.0
1,569stars
BSD 3-Clause License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
54/100Fair
Development Activity32
Maintenance24
Community60
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
72/100Good
Architecture75
Code Quality72
Innovation85
Learning Curve55

Snappy is Google’s Go implementation of the Snappy compression format — a fast, general-purpose compressor optimized for speed rather than maximum compression ratio. It provides both a block API (Encode/Decode) for when the full size of data is known upfront, and a streaming API (Reader/Writer) implementing the Go io interfaces for the framing format used when data arrives incrementally.

Performance-critical paths are backed by hand-written amd64 and arm64 assembly, with pure-Go fallbacks for other platforms, and the encoded output is byte-for-byte compatible with the canonical C++ Snappy implementation. It has no external dependencies and is widely used as the compression layer inside other Go infrastructure projects — databases, message queues, and storage engines — where throughput matters more than compression ratio.

What You Get

  • Encode/Decode functions for the Snappy block format, for use when the full input size is known upfront
  • Reader and Writer types implementing io.Reader/io.Writer for the Snappy streaming (framing) format
  • Hand-tuned amd64 and arm64 assembly implementations with automatic pure-Go fallback via build tags
  • A small cmd/snappytool CLI binary for manual encode/decode testing from the command line

Common Use Cases

  • Compressing values before writing them to an embedded key-value store or database to reduce disk I/O
  • Compressing messages on a message queue or RPC transport where CPU overhead must stay low
  • Adding Snappy-compressed stream support to a custom file format or network protocol via the Writer/Reader types
  • Interoperating with existing Snappy-compressed data produced by the canonical C++ implementation or other language ports

Under The Hood

Architecture Snappy separates concerns cleanly: the public API surface (encode.go, decode.go, snappy.go) exposes Encode/Decode block functions plus Reader/Writer stream types implementing io.Reader/io.Writer, while the actual byte-level codec logic is split by build tag into architecture-specific implementations — decode_asm.go/encode_asm.go declare assembly-backed decode/encode functions (backed by decode_amd64.s, decode_arm64.s, encode_amd64.s, encode_arm64.s) for amd64/arm64, falling back to pure-Go decode_other.go/encode_other.go on other platforms via build constraints. It’s a flat, single-package design with no internal layering or dependency injection — the boundary that matters is the build-tag-selected codec implementation, and changing the core varint/tag encoding scheme defined in snappy.go would require synchronized changes across the Go and assembly files for each architecture.

Tech Stack Pure Go standard library only — go.mod declares the module with no external dependencies, and the package uses only hash/crc32, encoding/binary, errors, and io. Performance-critical encode/decode paths are hand-written amd64 and arm64 assembly invoked via Go’s assembly calling convention, with build-tag-gated pure-Go fallbacks for unsupported architectures (appengine, noasm, non-amd64/arm64 targets). A minor cmd/snappytool binary wraps the library as a CLI encoder/decoder for manual testing. No build tooling is needed beyond go build/go test; the deployment target is any Go module that imports the package.

Code Quality The repo has extensive test coverage relative to its implementation size — golden-fixture tests and a large hand-written test suite together cover round-trip encode/decode correctness, cross-validation against the C++ reference implementation’s output, and edge cases like corrupt input and oversized blocks. Error handling is explicit and typed via sentinel errors (ErrCorrupt, ErrTooLarge, ErrUnsupported) rather than silent failures, with one documented panic reserved for a too-large-to-encode input. No CI configuration is present in the cloned repository, so automated test execution isn’t verifiable from the source tree alone. Naming follows idiomatic Go conventions, and there’s no dedicated linter config beyond standard go vet/gofmt expectations.

API Design The public API is minimal and idiomatic: two top-level functions (Encode, Decode) for the block format, plus Reader/Writer types that satisfy the standard io.Reader/io.Writer interfaces for the streaming format, requiring no configuration to get started beyond importing the module. Documentation is thorough at the package and function level, including an explicit deprecation notice steering callers from the unbuffered NewWriter toward NewBufferedWriter, and a package-level comment clarifying that the block and stream formats are incompatible — a common integration pitfall it heads off directly. Boilerplate is very low and naming is consistent with the standard library’s compress/* packages, though documentation lives only in godoc comments and the README rather than a dedicated site.

Used by 8 apps in this directory

Go
63%
Apache 2.0

Coroot

Analytics · Monitoring

7,895

eBPF-powered observability with AI root cause analysis — zero code changes required, full-stack visibility out of the box.

View details
88
Repo Health
80
Technical
65
Dependency
Built with
Go63%
Vue35%
Updated 3 days ago
Go
79%
Apache 2.0

Dolt

Databases · Data Engineering · Developer Tools

24,298

The SQL database you can branch, merge, diff, and clone — Git for your data, MySQL-compatible and ready for multi-agent AI workflows.

View details
90
Repo Health
9
Technical
67
Dependency
Built with
Go79%
Shell20%
Updated 2 days ago
TypeScript
49%
AGPL 3.0

Grafana

Monitoring · Analytics

76,498

The open-source observability platform that unifies metrics, logs, and traces from any data source into dynamic, queryable dashboards.

View details
95
Repo Health
91
Technical
65
Dependency
Built with
TypeScript49%
Go45%
Updated today
TypeScript
71%
Other

highlight.io

Developer Tools · Analytics · Monitoring

9,373

Open-source full-stack monitoring that unifies session replay, error tracking, logging, and distributed tracing so you can stop context-switching between tools.

View details
70
Repo Health
78
Technical
65
Dependency
Built with
TypeScript71%
Go16%
Updated 1 weeks ago
Go
95%
Apache 2.0

Nakama

Developer Tools · Game Development

13,238

Open-source game backend server with built-in multiplayer, matchmaking, leaderboards, chat, authentication, and storage — deploy anywhere via Docker or binary.

View details
88
Repo Health
73
Technical
74
Dependency
Built with
Go95%
Updated 5 days ago
Go
98%
Apache 2.0

Nightingale

Monitoring

13,272

Open-source alerting engine that connects to any time-series or log data source and routes alarms to 20+ notification channels with AI-assisted triage.

View details
96
Repo Health
77
Technical
68
Dependency
Built with
Go98%
Updated today
Go
100%
Apache 2.0

SpiceDB

Security · Authentication · Databases

7,001

An open source, Google Zanzibar-inspired authorization database that models permissions as relationships and evaluates fine-grained access checks at massive scale with single-digit millisecond latency.

View details
89
Repo Health
89
Technical
69
Dependency
Built with
Go100%
Updated 2 days ago
Go
95%
Apache 2.0

TiDB

Databases · AI Development

40,477

AI-Native Distributed SQL Database for Agentic Workloads

View details
97
Repo Health
66
Technical
68
Dependency
Built with
Go95%
Updated today

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search