MCPcopy
hub / github.com/tinylib/msgp / BenchmarkIntSorted_EncodeMsg

Function BenchmarkIntSorted_EncodeMsg

msgp/setof/generated_test.go:1196–1219  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

1194}
1195
1196func BenchmarkIntSorted_EncodeMsg(b *testing.B) {
1197 sizes := []int{10, 100, 1000}
1198
1199 for _, size := range sizes {
1200 b.Run(fmt.Sprintf("%d", size), func(b *testing.B) {
1201 set := make(IntSorted)
1202 for i := 0; i < size; i++ {
1203 set[int(i)] = struct{}{}
1204 }
1205
1206 var buf bytes.Buffer
1207 writer := msgp.NewWriter(&buf)
1208
1209 b.ReportAllocs()
1210 b.ResetTimer()
1211 for i := 0; i < b.N; i++ {
1212 buf.Reset()
1213 writer.Reset(&buf)
1214 set.EncodeMsg(writer)
1215 writer.Flush()
1216 }
1217 })
1218 }
1219}
1220
1221func BenchmarkIntSorted_DecodeMsg(b *testing.B) {
1222 sizes := []int{10, 100, 1000}

Callers

nothing calls this directly

Calls 5

ResetMethod · 0.95
FlushMethod · 0.95
NewWriterFunction · 0.92
EncodeMsgMethod · 0.65
ResetMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…