Skip to content

Commit

Permalink
perf(debian): use bytes.Index in emptyLineSplit to cut allocation (
Browse files Browse the repository at this point in the history
  • Loading branch information
paulcacheux committed Jul 2, 2024
1 parent fc6b3a7 commit acbec05
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions pkg/fanal/analyzer/pkg/dpkg/scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"bytes"
"io"
"net/textproto"
"strings"
)

type dpkgScanner struct {
Expand Down Expand Up @@ -42,7 +41,7 @@ func emptyLineSplit(data []byte, atEOF bool) (advance int, token []byte, err err
return 0, nil, nil
}

if i := strings.Index(string(data), "\n\n"); i >= 0 {
if i := bytes.Index(data, []byte("\n\n")); i >= 0 {
// We have a full empty line terminated block.
return i + 2, data[0:i], nil
}
Expand Down

0 comments on commit acbec05

Please sign in to comment.