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

Function BenchmarkStringSorted_UnmarshalMsg

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

Source from the content-addressed store, hash-verified

608}
609
610func BenchmarkStringSorted_UnmarshalMsg(b *testing.B) {
611 sizes := []int{10, 100, 1000}
612
613 for _, size := range sizes {
614 b.Run(fmt.Sprintf("%d", size), func(b *testing.B) {
615 set := make(StringSorted)
616 for i := 0; i < size; i++ {
617 set[fmt.Sprintf("val%d", i)] = struct{}{}
618 }
619
620 data, _ := set.MarshalMsg(nil)
621
622 b.ReportAllocs()
623 b.ResetTimer()
624 for i := 0; i < b.N; i++ {
625 var decoded StringSorted
626 _, err := decoded.UnmarshalMsg(data)
627 if err != nil {
628 b.Fatal(err)
629 }
630 }
631 })
632 }
633}
634
635func BenchmarkStringSorted_AsSlice(b *testing.B) {
636 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…