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

Function BenchmarkUintSorted_EncodeMsg

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

Source from the content-addressed store, hash-verified

1854}
1855
1856func BenchmarkUintSorted_EncodeMsg(b *testing.B) {
1857 sizes := []int{10, 100, 1000}
1858
1859 for _, size := range sizes {
1860 b.Run(fmt.Sprintf("%d", size), func(b *testing.B) {
1861 set := make(UintSorted)
1862 for i := 0; i < size; i++ {
1863 set[uint(i)] = struct{}{}
1864 }
1865
1866 var buf bytes.Buffer
1867 writer := msgp.NewWriter(&buf)
1868
1869 b.ReportAllocs()
1870 b.ResetTimer()
1871 for i := 0; i < b.N; i++ {
1872 buf.Reset()
1873 writer.Reset(&buf)
1874 set.EncodeMsg(writer)
1875 writer.Flush()
1876 }
1877 })
1878 }
1879}
1880
1881func BenchmarkUintSorted_DecodeMsg(b *testing.B) {
1882 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…