Skip to content

Bump mojo-regex to 0.9.0#251

Merged
carolinefrasca merged 5 commits intomodular:mainfrom
msaelices:regex-0.9.0-bump
Apr 2, 2026
Merged

Bump mojo-regex to 0.9.0#251
carolinefrasca merged 5 commits intomodular:mainfrom
msaelices:regex-0.9.0-bump

Conversation

@msaelices
Copy link
Copy Markdown
Contributor

Summary

Bump mojo-regex from 0.7.0 to 0.9.0.

v0.9.0 - PikeVM and Lazy DFA

  • PikeVM engine: Thompson NFA simulation with fixed-size SIMD state tracking and first-byte prefilter. Eliminates exponential backtracking.
  • Lazy DFA: Caches PikeVM state-set transitions as DFA states. After warmup (~20 bytes), most transitions are O(1) cache hits. Patterns like flexible_phone are now 0.6x vs Rust's regex crate.
  • rfind for .* last-literal: Single-pass reverse search instead of repeated forward search.
  • Win rates: 96% vs Python (59/61), 53% vs Rust (30/56)

v0.8.0 - DFA and SIMD optimizations

  • Nibble-based SIMD: Character class matching using native pshufb instructions
  • DFA extensions: Non-capturing alternation groups, variable-length branches, deeply nested groups, capturing group flattening
  • .* fast paths: Skip NFA entirely for .*LITERAL and LITERAL.* patterns
  • Parser fixes: Escaped characters, dash outside brackets, DFA start state
  • Fair benchmarks: Pre-compiled regex, median timing, auto-calibration across all three engines

See full changelog: https://github.com/msaelices/mojo-regex/blob/main/CHANGELOG.md

carolinefrasca
carolinefrasca previously approved these changes Apr 2, 2026
Updated rev to include @always_inline on lazy DFA hot path and
unchecked state access. Win rate vs Python: 97% (was 96%).
carolinefrasca and others added 2 commits April 2, 2026 16:03
…ular#93)

Updated rev to include SIMD range comparison for contiguous byte ranges.
Win rate vs Python: 100% (61/0). Win rate vs Rust: 57% (32/24).
@carolinefrasca carolinefrasca merged commit 077b38d into modular:main Apr 2, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants