Skip to content

Commit

Permalink
perf(logql): Micro-optimizations for IP filter (grafana#14072)
Browse files Browse the repository at this point in the history
Co-authored-by: Cyril Tovena <cyril.tovena@gmail.com>
  • Loading branch information
2 people authored and pull[bot] committed Jan 14, 2025
1 parent 89dc82b commit 5fc175b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/logql/log/ip.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,14 +282,14 @@ func isHexDigit(r byte) bool {
// It returns the number of chars in the initial segment of `s`
// which consist only of chars from `accept`.
func bytesSpan(s, accept []byte) int {
m := make(map[byte]bool)
var charset [256]bool

for _, r := range accept {
m[r] = true
charset[r] = true
}

for i, r := range s {
if !m[r] {
if !charset[r] {
return i
}
}
Expand Down

0 comments on commit 5fc175b

Please sign in to comment.