summaryrefslogtreecommitdiff
path: root/internal/regex/bench_test.go
AgeCommit message (Collapse)Author
2025-07-02perf: optimize grep for simple string matchingPaul Buetow
Add literal string detection to bypass regex compilation for patterns without metacharacters. This provides ~4x performance improvement for common grep patterns like "ERROR" or "WARNING". - Detect literal patterns (no regex metacharacters) at compile time - Use bytes.Contains/strings.Contains for literal matching - Maintain full backward compatibility and serialization format - Add comprehensive tests and benchmarks Benchmark results show: - Literal matching: 107.4 ns/op (optimized) - Regex matching: 439.2 ns/op (original) - Direct bytes.Contains: 88.51 ns/op (baseline) 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>