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

Function BenchmarkString_UnmarshalMsg

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

Source from the content-addressed store, hash-verified

471}
472
473func BenchmarkString_UnmarshalMsg(b *testing.B) {
474 sizes := []int{10, 100, 1000}
475
476 for _, size := range sizes {
477 b.Run(fmt.Sprintf("%d", size), func(b *testing.B) {
478 set := make(String)
479 for i := 0; i < size; i++ {
480 set[fmt.Sprintf("val%d", i)] = struct{}{}
481 }
482
483 data, _ := set.MarshalMsg(nil)
484
485 b.ReportAllocs()
486 b.ResetTimer()
487 for i := 0; i < b.N; i++ {
488 var decoded String
489 _, err := decoded.UnmarshalMsg(data)
490 if err != nil {
491 b.Fatal(err)
492 }
493 }
494 })
495 }
496}
497
498func BenchmarkString_AsSlice(b *testing.B) {
499 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…