Halide's wpd Decoder: 3.19x Faster Than libwebp, Written in Rust

Memory-Safe WebP Decoding

Halide's wpd Decoder: 3.19x Faster Than libwebp, Written in Rust

Halide released wpd, a WebP decoder written in Rust that is faster and safer than libwebp. It addresses memory safety vulnerabilities like CVE-2023-4863, which was actively exploited. Benchmarks show up to 3.19x speedup in multithreaded lossless decoding, with single-threaded gains from pure algorithmic improvements. wpd offers full libwebp feature parity plus extras like parallel animation frame decode-ahead and explicit thread-count setting. It's open source under BSD 2-Clause.

To address this, wpd is written in Rust, with handwritten assembly routines for performance.
  1. jessa0

    Related is Signal Messenger's webpsan crate, which validates webp container syntax before it is passed to libwebp. It stops just short of decoding actual pixel data, however, as the way webp works requires the entire canvas to be allocated in order to fully decode pixel data, which would have just made webpsan a full-on decoder anyway..

    https://docs.rs/webpsan/latest/webpsan/

  2. ZeroGravitas

    As part of Google's PR for their upcoming Gemini 4 Argon LLM release they said they'd rewritten a few things in rust replacing hand written simd. But I don't think webp was mentioned.

    They said:

    > Large Scale Codebase Migrations and Optimizations: Argon agents are working on migrating C/C++ codebases to Rust across Google — scaling from tens of thousands of lines in core libraries like re2, libgav1 up to 800K+ lines for the Fuchsia Zircon kernel. Given the criticality of many of these systems, such large-scale rewrites are undergoing rigorous automated and manual auditing, emulation testing, and review before rolling out to production.

    > For libgav1, Google's open source software for decoding video, Argon agents took an existing Rust port and replaced 32K lines of SIMD code by running many rounds of profile-guided experiments, studying the compiler's output, producing safe Rust so the compiler would vectorize it automatically. The end result is a memory-safe video decoder that runs 2.7x faster than the Rust port, with identical video output, bringing it closer to the optimized C++.

  3. omoikane

    I am not sure what's the current status of Wuffs-based WebP decoder, but that would be another implementation worth comparing since it shares the same goals of safety and speed.

    https://github.com/google/wuffs/tree/main/std/webp

More from this day

2026-10-03