perf: build log-mask automaton as a contiguous nfa (#12088)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Ruben Fiszel
2026-10-28 22:31:08 +01:00
committed by GitHub
co-authored by Claude Opus 5.5
parent d03142ba39
commit 97de072e7f
@@ -184,7 +184,11 @@ fn compile(secrets: &HashSet<String>) -> CompiledMasks {
})
.collect();
// Built once per job (its token is always a secret) and searched over little log text, so
// the default DFA's build cost dominates; a contiguous NFA searches as fast here since
// the literal prefilter does the scanning.
let ac = aho_corasick::AhoCorasickBuilder::new()
.kind(Some(aho_corasick::AhoCorasickKind::ContiguousNFA))
.match_kind(aho_corasick::MatchKind::LeftmostLongest)
.build(sorted.iter().map(|s| s.as_str()))
.expect("failed to build aho-corasick automaton");