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

Function BenchmarkIntSorted_UnmarshalMsg

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

Source from the content-addressed store, hash-verified

1268}
1269
1270func BenchmarkIntSorted_UnmarshalMsg(b *testing.B) {
1271 sizes := []int{10, 100, 1000}
1272
1273 for _, size := range sizes {
1274 b.Run(fmt.Sprintf("%d", size), func(b *testing.B) {
1275 set := make(IntSorted)
1276 for i := 0; i < size; i++ {
1277 set[int(i)] = struct{}{}
1278 }
1279
1280 data, _ := set.MarshalMsg(nil)
1281
1282 b.ReportAllocs()
1283 b.ResetTimer()
1284 for i := 0; i < b.N; i++ {
1285 var decoded IntSorted
1286 _, err := decoded.UnmarshalMsg(data)
1287 if err != nil {
1288 b.Fatal(err)
1289 }
1290 }
1291 })
1292 }
1293}
1294
1295func BenchmarkIntSorted_AsSlice(b *testing.B) {
1296 sizes := []int{10, 100, 1000}

Callers

nothing calls this directly

Calls 2

UnmarshalMsgMethod · 0.95
MarshalMsgMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…