MCPcopy Create free account
hub / github.com/AdRoll/baker / BenchmarkLogLineToTextFromParse

Function BenchmarkLogLineToTextFromParse

bench_test.go:175–196  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

173 }
174}
175func BenchmarkLogLineToTextFromParse(b *testing.B) {
176 fields := make([][]byte, 0, baker.LogLineNumFields)
177 for i := 0; i < int(baker.LogLineNumFields); i++ {
178 fields = append(fields, []byte("xxxxxxxxxx"))
179 }
180
181 nparse := []int{1, 50, 500, 1000, 2000, 3000}
182 for _, nparse := range nparse {
183 b.Run(fmt.Sprintf("parse=%d", nparse), func(b *testing.B) {
184 text := bytes.Join(fields[:nparse], []byte(","))
185
186 ll := baker.LogLine{FieldSeparator: ','}
187 ll.Parse(text, nil)
188
189 b.ReportAllocs()
190 b.ResetTimer()
191 for n := 0; n < b.N; n++ {
192 _ = ll.ToText(nil)
193 }
194 })
195 }
196}
197func BenchmarkLogLineToTextFromParseSet(b *testing.B) {
198 fields := make([][]byte, 0, baker.LogLineNumFields)
199 for i := 0; i < int(baker.LogLineNumFields); i++ {

Callers

nothing calls this directly

Calls 3

ParseMethod · 0.95
ToTextMethod · 0.95
RunMethod · 0.65

Tested by

no test coverage detected