diff options
| author | Paul Buetow <paul@buetow.org> | 2025-07-02 18:55:31 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2025-07-02 18:55:31 +0300 |
| commit | df62b7587929fd4cee5ab22c52a0e9b6035b821e (patch) | |
| tree | de320c53f0c01a04af3521d835ffa534e0e8b6b9 /examples | |
| parent | e74957dd14d0b1d996ae7b67f000f2bb6296c6a7 (diff) | |
perf: optimize grep for simple string matching
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>
Diffstat (limited to 'examples')
0 files changed, 0 insertions, 0 deletions
