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

Function BenchmarkByteSorted_EncodeMsg

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

Source from the content-addressed store, hash-verified

2514}
2515
2516func BenchmarkByteSorted_EncodeMsg(b *testing.B) {
2517 sizes := []int{10, 100, 1000}
2518
2519 for _, size := range sizes {
2520 b.Run(fmt.Sprintf("%d", size), func(b *testing.B) {
2521 set := make(ByteSorted)
2522 for i := 0; i < size; i++ {
2523 set[byte(i%256)] = struct{}{}
2524 }
2525
2526 var buf bytes.Buffer
2527 writer := msgp.NewWriter(&buf)
2528
2529 b.ReportAllocs()
2530 b.ResetTimer()
2531 for i := 0; i < b.N; i++ {
2532 buf.Reset()
2533 writer.Reset(&buf)
2534 set.EncodeMsg(writer)
2535 writer.Flush()
2536 }
2537 })
2538 }
2539}
2540
2541func BenchmarkByteSorted_DecodeMsg(b *testing.B) {
2542 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…