Skip to content

Commit 920cf56

Browse files
authored
Merge pull request #76 from trifectatechfoundation/zstd-announcement
Zstd announcement
2 parents b065b27 + 294ead4 commit 920cf56

6 files changed

Lines changed: 120 additions & 24 deletions

File tree

content/_index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ supporters = [
3030
]
3131

3232
blogposts = [
33+
"Announcing Zstandard in Rust",
3334
"Three years of Rusty sudo",
3435
"Announcing ntpd-rs in Ubuntu",
3536
"Video: Securing time with NTS (FOSDEM26)",
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
+++
2+
title = "Announcing Zstandard in Rust"
3+
slug = "announcing-zstandard-in-rust"
4+
authors = ["Folkert de Vries"]
5+
date = "2026-05-28"
6+
7+
[taxonomies]
8+
tags = ["libzstd-rs", "announcement"]
9+
10+
+++
11+
12+
Over the past year, we've been silently working on our third compression project. After [zlib](https://github.com/trifectatechfoundation/zlib-rs) and [bzip2](https://github.com/trifectatechfoundation/libbzip2-rs) we're now taking on zstd with [libzstd-rs-sys](https://github.com/trifectatechfoundation/libzstd-rs-sys), and are proud to announce its first release.
13+
14+
<!-- more -->
15+
16+
Zstd is a compression format that has been designed with modern CPUs in mind. It is both much faster and able to compress better than gzip. It is already widely used, and we expect that it will continue to gradually replace gzip for web traffic.
17+
18+
## Why though?
19+
20+
Using zstd in Rust is already supported via the [zstd](https://crates.io/crates/zstd) crate, so why bother with a whole new implementation?
21+
22+
### Portability
23+
24+
One practical advantage of Rust is that it is straightforward to write portable software. Currently the `zstd` crate compiles the C code from source, which requires a C toolchain for the target and for the target to be supported at all. Setting up a C toolchain on Windows or for webassembly can be a challenge, and isn't needed with a pure-Rust implementation. For Rust programmers, using dependencies written in Rust is a superior experience.
25+
26+
### Drop-in replacement
27+
28+
Additionally, like with zlib and bzip2, we support compiling `libzstd-rs-sys` into a drop-in compatible C library. Hence we are, or aim to be, an alternative to the C reference implementation.
29+
30+
### Strengthening the ecosystem
31+
32+
The [C reference implementation](https://github.com/facebook/zstd) is maintained by Meta, and requires signing a contributor agreement with them in order to contribute. We believe that an independent, performant and compatible implementation strengthens the open source ecosystem.
33+
34+
## Current state
35+
36+
The reference implementation was initially translated using [`c2rust`](https://c2rust.com/), and we have since completed the cleanup work for decompression and the dictionary builder.
37+
38+
We test our Rust code (compiled into a C static library) with the the reference implementation's test suite. We additionally use fuzz testing and Miri, so we're confident in the correctness of our implementation.
39+
40+
The pre-release is available here: https://github.com/trifectatechfoundation/libzstd-rs-sys/releases/tag/v0.0.1-prerelease.2.
41+
42+
This work has also had ecosystem benefits: we've found several limitations of Miri (that are now resolved) and made contributions to Clippy. A more complete write-up of our recent contributions can be found [here](https://trifectatech.org/blog/fixing-our-own-problems-in-the-rust-compiler/).
43+
44+
### The cost of memory safety
45+
46+
By default decompression performance of our implementation is a few percent slower than the C reference implementation. We benchmark each merge in to `main` in our [benchmark suite](https://trifectatechfoundation.github.io/libzstd-rs-sys-bench/).
47+
48+
We believe we can justify this regression though, because with the `unsafe-performance-experimental` feature flag enabled we match C performance. This feature flag disables 4 bounds checks where data from the input is used to index into a data structure. For most users a ~3% performance regression is likely an acceptable price to pay for increased memory safety. If you really do need that last bit of performance, you can enable the flag at your own risk. Its behavior in these four locations matches C which also does not check the bounds and appears to run just fine in many production systems.
49+
50+
## Future
51+
52+
We are looking for funding of the compression portion of this library.
53+
54+
Because of code sharing between compression and decompression, we have looked at the compression code a bit, but most of the cleanup work still needs to be done. We did set up benchmarks to ensure compression performance does not unexpectedly regress, and as mentioned we already use the reference implementation's test suite to check that we produce the correct result.
55+
56+
### Ecosystem integration
57+
58+
We have our own fork of the `zstd` that uses `libzstd-rs-sys` instead of the C library. We'd like to upstream this at some point.
59+
60+
For the most commonly-used APIs this is straightforward. For the `experimental` features we run into some mismatches where `zstd-safe` uses an enum but we must use a `struct` for FFI safety.
61+
62+
## Thanks to our sponsors
63+
64+
The work on the decompression side has been funded by [Chainguard](https://www.chainguard.dev/), [Astral](https://astral.sh/) and [NLnet Foundation](https://nlnet.nl/), and we're grateful for their support! [Sovereign Tech Agency](https://sovereign.tech) invested in the dictionary builder; thank you!
65+
66+
---
67+
68+
### About
69+
70+
[**Trifecta Tech Foundation**](https://trifectatech.org) is a non-profit and a Public Benefit Organisation (501(c)(3) equivalent) that creates open-source building blocks for critical infrastructure software. Our initiatives on data compression, time synchronization, and privilege boundary, impact the digital security of millions of people. If you’d like to support our work, please contact us; see [trifectatech.org/support](https://trifectatech.org/support/).
71+
72+
[**Astral**](https://astral.sh/) builds high-performance developer tools for the Python ecosystem:
73+
- Ruff, an extremely fast Python linter, written in Rust.
74+
- uv, an extremely fast Python package manager, written in Rust.
75+
76+
Astral's mission is to make the Python ecosystem more productive. Learn more at [astral.sh](https://astral.sh/).
77+
78+
[**NLnet Foundation**](https://nlnet.nl/) is a recognised philanthropic non-profit foundation. The foundation stimulates network research and development in the domain of Internet technology. The articles of association for the NLnet Foundation state: "to promote the exchange of electronic information and all that is related or beneficial to that purpose". The prefered instrument of NLnet is awarding microgrants to small, independent projects supporting independent researchers and developers. Read more on [nlnet.nl](https://nlnet.nl/).
79+
80+
[**Chainguard**](https://www.chainguard.dev/) builds trusted open source software for a secure-by-default stack. Read more on [chainguard.dev](https://www.chainguard.dev/)
81+
82+
### Further Information
83+
84+
- [Data compression initiative on Trifecta Tech Foundation](https://trifectatech.org/initiatives/data-compression)
85+
- [libzstd-rs GitHub Repository](https://github.com/trifectatechfoundation/libzstd-rs-sys)
86+
87+
*For inquiries, please contact Erik Jonkers, [contact@trifectatech.org](mailto:contact@trifectatech.org)*

content/initiatives/data-compression.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ funders = [
2020
"chainguard",
2121
"ngi-zero-core",
2222
"min-bzk",
23-
"astral"
23+
"astral",
24+
"sta"
2425
]
2526

2627
supporters = [
@@ -31,6 +32,7 @@ supporters = [
3132
]
3233

3334
blogposts = [
35+
"Announcing Zstandard in Rust",
3436
"Compression compiler contributions",
3537
"zlib-rs stable API",
3638
"Emulating avx-512 intrinsics in Miri",

content/initiatives/workplans/workplan-zstd-rs.md

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,32 @@ backLink = "projects/libzstd-rs"
99
backTitle = "Back to project: Zstandard in Rust"
1010
+++
1111

12-
Work on zstd started in July 2025. The first milestone is the decompression portion of the library.
13-
14-
Now the decompression is in development, we're seeking funding for the *encoder*. Please [get in touch with us](/support), if you are interested in financially supporting the development of memory-safe zstd.
12+
Work on zstd started in July 2025. The first three milestones are now completed.
1513

1614
### In progress milestones
1715

16+
We're seeking funding for the *encoder*. Please [get in touch with us](/support), if you are interested in financially supporting the development of memory-safe zstd.
17+
18+
---
19+
20+
### Future work
21+
22+
**Milestone 4: Encoder implementation**
23+
24+
This milestone adds API-compatible zstd compression.
25+
26+
- Improving the code quality of the translated code
27+
- Improving the performance of the translated code
28+
- Testing & fuzzing
29+
- Audit
30+
- Create release and publish crates
31+
32+
Please contact us if you are interested in supporting this milestone; see [trifectatech.org/support](https://trifectatech.org/support/).
33+
34+
---
35+
36+
### Completed milestones
37+
1838
**Milestone 1: Decoder implementation**
1939

2040
This milestone adds API-compatible zstd decompression functionality.
@@ -44,22 +64,6 @@ This work is supported by [NLnet Foundation](https://nlnet.nl).
4464

4565
---
4666

47-
### Future work
48-
49-
**Milestone 4: Encoder implementation**
50-
51-
This milestone adds API-compatible zstd compression.
52-
53-
- Improving the code quality of the translated code
54-
- Improving the performance of the translated code
55-
- Testing & fuzzing
56-
- Audit
57-
- Create release and publish crates
58-
59-
Please contact us if you are interested in supporting this milestone; see [trifectatech.org/support](https://trifectatech.org/support/).
60-
61-
---
62-
6367

6468

6569

content/news.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ template = "news.html"
55

66
[extra]
77
blogposts = [
8+
"Announcing Zstandard in Rust",
89
"Three years of Rusty sudo",
910
"Tail calls project goal",
1011
"Compression compiler contributions",

content/projects/libzstd-rs.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ supporters = [
2424
]
2525

2626
blogposts = [
27+
"Announcing Zstandard in Rust",
2728
"Compression compiler contributions"
2829
]
2930
+++
@@ -36,15 +37,15 @@ For the high level goals of our data compression projects, see our [Data compres
3637

3738
### About
3839

39-
Development of Zstandard in Rust began in July 2025, with the first release of the decoder planned for March 2026.
40+
Development of Zstandard in Rust began in July 2025. In May of 2026 we released the first version that includes the decoder and the dictionaty builder.
4041

4142
We thank [Chainguard](https://www.chainguard.dev/), [Astral](https://astral.sh/), [Sovereign Tech Agency](https://sovereign.tech) and [NLnet Foundation](https://nlnet.nl) for their support.
4243

4344
### Roadmap
4445

45-
- 2025 Q3: start of decoder implementation
46-
- 2025 Q4: implementation of dictBuilder feature
47-
- 2026 Q1: release of decoder
46+
- 2025 Q3: start of decoder implementation (*completed*)
47+
- 2025 Q4: implementation of dictBuilder feature (*completed*)
48+
- 2026 Q1: release of decoder (*completed*)
4849
- 2026 Q2: start of encoder implementation (*pending funding*)
4950

5051
For details see [the workplan](/initiatives/workplans/libzstd-rs/).

0 commit comments

Comments
 (0)