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

Function BenchmarkInt_UnmarshalMsg

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

Source from the content-addressed store, hash-verified

1131}
1132
1133func BenchmarkInt_UnmarshalMsg(b *testing.B) {
1134 sizes := []int{10, 100, 1000}
1135
1136 for _, size := range sizes {
1137 b.Run(fmt.Sprintf("%d", size), func(b *testing.B) {
1138 set := make(Int)
1139 for i := 0; i < size; i++ {
1140 set[int(i)] = struct{}{}
1141 }
1142
1143 data, _ := set.MarshalMsg(nil)
1144
1145 b.ReportAllocs()
1146 b.ResetTimer()
1147 for i := 0; i < b.N; i++ {
1148 var decoded Int
1149 _, err := decoded.UnmarshalMsg(data)
1150 if err != nil {
1151 b.Fatal(err)
1152 }
1153 }
1154 })
1155 }
1156}
1157
1158func BenchmarkInt_AsSlice(b *testing.B) {
1159 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…