Skip to content

Match forward search dispatch flags together - #1379

Closed
fyrsta7 wants to merge 1 commit into
rust-lang:masterfrom
fyrsta7:perf/find-fwd-prefilter-match
Closed

Match forward search dispatch flags together#1379
fyrsta7 wants to merge 1 commit into
rust-lang:masterfrom
fyrsta7:perf/find-fwd-prefilter-match

Conversation

@fyrsta7

@fyrsta7 fyrsta7 commented Aug 2, 2026

Copy link
Copy Markdown

Summary

This rewrites the forward hybrid DFA search dispatch in find_fwd as a single match over the prefilter and earliest-search flags.

Why this can improve performance

find_fwd dispatches to four monomorphized search paths depending on whether a prefilter is present and whether earliest mode is enabled. Matching on both booleans together keeps the dispatch compact while preserving the same specialized calls for each case.

Validation

  • git diff --check
  • cargo check --manifest-path regex-automata/Cargo.toml --lib

Benchmark

Current machine, Rust release microbenchmark, 9 samples, median:

Benchmark Base This change Delta
Hybrid regex find_iter over a high-match haystack 24,418.079 ns/op 23,388.972 ns/op 4.21% faster

@fyrsta7
fyrsta7 marked this pull request as ready for review August 2, 2026 17:32
@fyrsta7 fyrsta7 closed this Aug 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant