Building fast interpreters in Rust
Mar 4, 2019Ingvar Stepanyan, Andrew Galloni

Summary
This post details the design of the wirefilter Rust library for parsing and executing Wireshark-like filters. It explains the choice of manual parsing over parser generators due to syntax ambiguities requiring contextual parsing. The execution engine was optimized by replacing HashMap lookups for field access with fixed-size arrays indexed by an IndexMap, leading to a ~2x speedup.
More from the Website Security & Threat Management trail
- We tested our own WAF with frontier AI models. Here’s what we found
- When scanners miss the attack: how Cloudflare Client-Side Security protects storefronts
- Introducing automatic remediation policies with Cloudflare CASB
- Introducing context-aware vulnerability discovery and remediation with Cloudflare Managed Defense and OpenAI Daybreak Models
- Introducing Adaptive Intelligence: undermining the economics of every bot attack