Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ func TestConcurrentGzipReaderUsage(t *testing.T) {
// concurrent usage
concurrent := 20
wg := sync.WaitGroup{}
for i := 0; i < concurrent; i++ {
for range concurrent {
wg.Add(1)
go func() {
defer wg.Done()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func BenchmarkUnmarshalLogs(b *testing.B) {
b.SetBytes(int64(len(logContent)))
b.ResetTimer()

for i := 0; i < b.N; i++ {
for b.Loop() {
// Create a new reader for each iteration to ensure consistent behavior
reader := bytes.NewReader(logContent)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func createELBAccessLogContent(b *testing.B, filename string, nLogs int) []byte

size := len(data) + 1 // + "\n"
buf := bytes.NewBuffer(make([]byte, 0, nLogs*size))
for i := 0; i < nLogs; i++ {
for i := range nLogs {
buf.Write(data)
if i != nLogs-1 {
buf.WriteString("\n")
Expand All @@ -59,7 +59,7 @@ func BenchmarkUnmarshalAWSLogs(b *testing.B) {
data := createELBAccessLogContent(b, bc.filename, bc.nLogs)
b.Run(bc.name, func(b *testing.B) {
b.ReportAllocs()
for i := 0; i < b.N; i++ {
for b.Loop() {
_, err := u.UnmarshalAWSLogs(bytes.NewReader(data))
require.NoError(b, err)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func newLogFileContent(b *testing.B, nLogs int) io.Reader {

size := len(data) + 1 // + "\n"
buf := bytes.NewBuffer(make([]byte, 0, nLogs*size))
for i := 0; i < nLogs; i++ {
for i := range nLogs {
buf.Write(data)
if i != nLogs-1 {
buf.WriteString("\n")
Expand All @@ -52,7 +52,7 @@ func BenchmarkUnmarshalLogs(b *testing.B) {
logs := newLogFileContent(b, benchmark.nLogs)
b.Run(name, func(b *testing.B) {
b.ReportAllocs()
for i := 0; i < b.N; i++ {
for b.Loop() {
_, err := u.UnmarshalAWSLogs(logs)
require.NoError(b, err)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func createVPCFlowLogContent(b *testing.B, filename string, nLogs int) []byte {

result := make([][]byte, nLogs+1)
result[0] = fieldLine
for i := 0; i < nLogs; i++ {
for i := range nLogs {
result[i+1] = flowLog
}
return bytes.Join(result, []byte{'\n'})
Expand Down Expand Up @@ -60,7 +60,7 @@ func BenchmarkUnmarshalUnmarshalPlainTextLogs(b *testing.B) {

b.Run(name, func(b *testing.B) {
b.ReportAllocs()
for i := 0; i < b.N; i++ {
for b.Loop() {
_, err := u.unmarshalPlainTextLogs(bytes.NewReader(data))
require.NoError(b, err)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func newWAFLogContent(b *testing.B, nLogs int) []byte {

compactedBytes := compacted.Bytes()
result := make([][]byte, nLogs)
for i := 0; i < nLogs; i++ {
for i := range nLogs {
result[i] = compactedBytes
}
return bytes.Join(result, []byte{'\n'})
Expand All @@ -53,7 +53,7 @@ func BenchmarkUnmarshalLogs(b *testing.B) {

b.Run(name, func(b *testing.B) {
b.ReportAllocs()
for i := 0; i < b.N; i++ {
for b.Loop() {
_, err := u.UnmarshalAWSLogs(bytes.NewReader(data))
require.NoError(b, err)
}
Expand Down