Commit 4c5c620
committed
Speed up containsTimestamp
Iterate over string bytes instead of runes to avoid unnecessary utf-8 decoding overhead:
```
goos: linux
goarch: amd64
pkg: github.com/coroot/logparser
│ main │ HEAD │
│ sec/op │ sec/op vs base │
ContainsTimestamp-8 56.71n ± 2% 42.36n ± 1% -25.32% (p=0.000 n=10)
```
Signed-off-by: Alexander Yastrebov <yastrebov.alex@gmail.com>1 parent 49b0847 commit 4c5c620
1 file changed
+2
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
0 commit comments