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

Function BenchmarkUint8Sorted_EncodeMsg

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

Source from the content-addressed store, hash-verified

3834}
3835
3836func BenchmarkUint8Sorted_EncodeMsg(b *testing.B) {
3837 sizes := []int{10, 100, 1000}
3838
3839 for _, size := range sizes {
3840 b.Run(fmt.Sprintf("%d", size), func(b *testing.B) {
3841 set := make(Uint8Sorted)
3842 for i := 0; i < size; i++ {
3843 set[uint8(i%256)] = struct{}{}
3844 }
3845
3846 var buf bytes.Buffer
3847 writer := msgp.NewWriter(&buf)
3848
3849 b.ReportAllocs()
3850 b.ResetTimer()
3851 for i := 0; i < b.N; i++ {
3852 buf.Reset()
3853 writer.Reset(&buf)
3854 set.EncodeMsg(writer)
3855 writer.Flush()
3856 }
3857 })
3858 }
3859}
3860
3861func BenchmarkUint8Sorted_DecodeMsg(b *testing.B) {
3862 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…