Mozilla moved Firefox 151's gzip path to zlib-rs, giving the browser a Rust zlib layer with stronger memory safety and higher x86_64 throughput.
Mozilla started shipping Firefox 151 with zlib-rs for gzip compression and decompression, according to Michael Larabel's June 16, 2026, Phoronix report. Mozilla replaced a C zlib path with a Rust implementation that keeps zlib API compatibility for Firefox's existing integration work.
{{IMAGE:2}}
Product
Trifecta Tech Foundation maintains zlib-rs as part of its data compression program and publishes the code on GitHub. Trifecta exposes two paths: a Rust crate for Rust applications and libz-rs-sys for applications that expect a C zlib ABI. That C-facing path matters for Firefox because browser developers carry old compression contracts into new code.
Mozilla and Trifecta engineers spent about two years moving from first talks to Firefox production use. That time frame gives builders a useful warning: zlib compatibility means more than matching function names. Compression levels carry behavior. Output size, speed and algorithm choice can differ across levels, and a browser team has to check web content, update packaging and platform builds.
zlib-rs handles the same daily work that classic zlib handles: DEFLATE streams and gzip wrappers. Firefox calls that code during page loads and data movement. Mozilla treats this layer as security-sensitive because a memory bug near decompression can expose many users. Rust reduces memory hazard classes, and tuned SIMD paths cut CPU time on common hardware.
Performance data
The Phoronix report points to much higher performance on x86_64 and smaller gains on AArch64. Trifecta's project page says zlib-rs reached parity with C zlib during 2025, and its README places performance near zlib-ng. Mozilla kept speed in the deal while it moved more compression code into Rust.

| Area | Reported result | Builder read |
|---|---|---|
| x86_64 gzip | Much higher performance than the prior path | Desktop Firefox users with recent AMD or Intel CPUs gain the most |
| AArch64 gzip | Smaller gains | Linux ARM boards and Apple Silicon can benefit, but platform zlib choices matter |
| Memory safety | Rust covers more compression code | Firefox removes a chunk of C attack surface from a hot data path |
| Compatibility | Level behavior required work | ABI support still needs output tests and regression runs |
| Power | Phoronix did not publish wattage in the supplied excerpt | Measure wall power before you claim energy gains |
The CPU issue deserves attention. Mozilla and Trifecta engineers hit Intel 13th Gen and 14th Gen Core instability problems during the migration. They added a small amount of new unsafe Rust to handle the issue. Large programs need hardware workarounds, SIMD and FFI boundaries. The engineering win comes from keeping unsafe code small and focused.
Compatibility needs the same discipline. Trifecta describes zlib-rs as drop-in compatible, and Firefox found algorithm differences at compression levels. Build engineers should expect that with compression libraries. Two implementations can accept the same API call and pass the same decompression corpus, then produce different compressed output at a given level. That can affect golden files, cache behavior and tests that compare bytes.
Build recommendations
Firefox users should update through Mozilla's normal release channel. Source builders should keep the browser's compression choice aligned with Mozilla's defaults unless they maintain a test matrix for gzip output, crash handling and platform CPU flags.
Linux distro maintainers should treat zlib-rs as more than a library swap. Run browser tests that exercise gzip over HTTP, extension packaging and update flows. Add corpora that include damaged streams and small chunks, because the zlib-rs README calls out performance behavior for tiny input sizes.
Homelab users who care about watts per request should measure both throughput and energy before they swap a system zlib. Use perf stat for cycles and instructions, RAPL or a wall meter for power, and a repeatable gzip corpus. Compare Firefox builds on the same machine, same governor and same workload. CPU time can fall without a matching wall-power cut if the workload waits on network or storage.
x86_64 systems look like the best target for early wins. AArch64 users should test against the platform zlib they already ship, especially on macOS, where Apple supplies its own zlib. zlib-rs can tune code in places where a vendor zlib may leave performance unused, but the margin depends on the workload.
The Firefox move gives Rust compression a large production proving ground. Mozilla gets memory safety on a common browser path, Trifecta gets real-world pressure from a major application, and builders get a concrete benchmark target instead of a theory about safer systems code.

Comments
Please log in or register to join the discussion