Open
Description
Zstandard (RFC 8878) is well-positioned to replaced GZIP (RFC 1952) as the de-facto compression format.
Zstandard:
- is faster to compress/decompress than GZIP,
- has much better compression ratios,
- is well-specified,
- is backed by a prominent company, and
- is seeing increased adoption in use with archives and as a browser content encoding.
Given the likely ubiquitous place Zstandard is going have in the future, I propose first-class adoption of Zstandard in the stdlib.
Existing Go implementations:
- @klauspost has an excellent Zstandard implementation at github.com/klauspost/compress/zstd, but the API is a somewhat complex and it makes use of native assembly.
- @ianlancetaylor implemented a Zstandard decompressor in internal/zstd without any use of
unsafe
or assembly.
Some goals for this package:
- The API be simple and similar to existing packages like
compress/gzip
. - It does not use
unsafe
or assembly similar to the existing compress package.- Performance is always nice, but Go community surveys consistently shows security as more important than performance.
- Users who just need a decently fast enough Zstandard implementation can use
compress/zstd
, while those want the best performance and/or advanced features of Zstandard can use @klauspost's package. Any stdlib packages (e.g.,net/http
that make use ofcompress/zstd
should make it possible to swap over to a differentzstd
implementation). - Note that the same is already true of
compress/gzip
, which is generally good enough (although there is still room for performance optimizations), but power users can use github.com/klauspost/compress/gzip, which is much faster (as it makes use of assembly).
We could:
- adopt @klauspost's pure-Go (i.e., no assembly) implementation with a cleaned-up API
- extend @ianlancetaylor's work to support compressing
- do a combination of both
Related issues:
Metadata
Metadata
Assignees
Type
Projects
Status
Accepted