Introduction
Glob pattern matching is a foundational operation in JavaScript bundlers and file watchers, yet its performance often becomes a bottleneck in complex workflows. The go-to library for this task, picomatch, relies on compiling patterns into regular expressions and leans heavily on V8 for execution. While effective, this approach introduces inefficiencies, particularly in one-shot matching scenarios, where the overhead of regex compilation and V8’s interpretation can degrade performance.
To address these limitations, I developed zeromatch, a Rust-based glob matcher designed as a JavaScript native addon. Zeromatch replaces regex-based matching with a bytecode virtual machine (VM), which includes optimized fast paths for common patterns. This design choice eliminates the need for regex compilation and reduces dependency on V8, directly addressing the performance bottlenecks of picomatch.
Mechanisms Behind the Performance Gains
The performance improvement in zeromatch stems from two key mechanisms:






