Skip to content

Commit acbec05

Browse files
authored
perf(debian): use bytes.Index in emptyLineSplit to cut allocation (#7065)
1 parent fc6b3a7 commit acbec05

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

pkg/fanal/analyzer/pkg/dpkg/scanner.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55
"bytes"
66
"io"
77
"net/textproto"
8-
"strings"
98
)
109

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

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

0 commit comments

Comments
 (0)