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

Function BenchmarkLogLineToTextFromSet

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

Source from the content-addressed store, hash-verified

156}
157
158func BenchmarkLogLineToTextFromSet(b *testing.B) {
159 nset := []int{1, 5, 50, 100, 254}
160 for _, nset := range nset {
161 b.Run(fmt.Sprintf("set=%d", nset), func(b *testing.B) {
162 ll := baker.LogLine{FieldSeparator: baker.DefaultLogLineFieldSeparator}
163 for i := 0; i < nset; i++ {
164 ll.Set(baker.FieldIndex(i), []byte("xxxxxxxxxx"))
165 }
166
167 b.ReportAllocs()
168 b.ResetTimer()
169 for n := 0; n < b.N; n++ {
170 _ = ll.ToText(nil)
171 }
172 })
173 }
174}
175func BenchmarkLogLineToTextFromParse(b *testing.B) {
176 fields := make([][]byte, 0, baker.LogLineNumFields)
177 for i := 0; i < int(baker.LogLineNumFields); i++ {

Callers

nothing calls this directly

Calls 4

SetMethod · 0.95
ToTextMethod · 0.95
FieldIndexTypeAlias · 0.92
RunMethod · 0.65

Tested by

no test coverage detected