Urgent.News

What's breaking now, across thousands of outlets.

Culture

I ported Picomatch to Rust. It passed 1,977 tests and lost the benchmark by 18x

A Port Mortem 2026 write-up about a JavaScript to Rust port, one strange Unicode character, and what green tests do not tell you. The first benchmark result was not flattering. Picomatch, running under Node, handled about 7.18 million matches per second in my test. The direct Rust implementation managed about 395,000. That made the Rust version roughly 18.2 times slower. I kept the result because…

This article discusses the process of porting the popular JavaScript library Picomatch to Rust and the challenges encountered during the process. Picomatch is a dependency-free glob matcher used across the JavaScript ecosystem, and the port was attempted as a 72-hour project. The Rust implementation was able to pass 1,977 tests, but it performed significantly slower than the original JavaScript version, taking about 18.2 times longer to match patterns.

The author faced difficulties in verifying the accuracy of the port due to the complexity of the library, which includes features such as globstars, nested extglobs, braces, negation, captures, callbacks, Bash and minimatch options, Windows separators, JavaScript regex flags, UTF-16 indexes, and inputs designed to make a parser or regex engine suffer.

Despite initial success, further differential testing revealed additional issues, such as handling of the Latin long s character. To address this, the author pinned Node 24.18.0 and derived the complete legacy Canonicalize table for the Basic Multilingual Plane, which helped improve the accuracy of the Rust implementation.

Brief written by urgent.news from Dev.to's own syndicated text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Culture

Scarlett Johansson, skin care mogul

Actress Scarlett Johansson has played many roles in her career – and now, the Tony-winner and two-time Oscar-nominee has taken on another: launching her new line of products, called The Outset…

More from Sunday 2 August →