Automata, Built For Comfort or Speed

This title could be clearer and more informative.Try out Clickbait Shieldfor free (5 uses left this month).

Tim Bray shares a progress update on Quamina, his Go library for matching JSON events against patterns using finite automata. The post explores the tradeoffs between NFA and DFA modes, introduced via new BuiltForComfort and BuiltForSpeed API options. Benchmarks using 13K Wordle-derived wildcard patterns reveal that DFA conversion offers roughly 2x faster matching but at severe memory and build-time costs: 300 DFA patterns consume 45MB and take 7.7 seconds to load, while 10K NFA patterns use only 27MB and load in 2.3ms. The practical advice is to use NFA mode (default) for most use cases, and only enable DFA conversion for small sets of regexp patterns where matching speed is critical. Bray also reflects on Quamina's maturity and limited user base, musing about future format adapters and possibly writing a monograph.

7m read timeFrom tbray.org
Post cover image
6.7K Impressions