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

Function BenchmarkStringSorted_EncodeMsg

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

Source from the content-addressed store, hash-verified

534}
535
536func BenchmarkStringSorted_EncodeMsg(b *testing.B) {
537 sizes := []int{10, 100, 1000}
538
539 for _, size := range sizes {
540 b.Run(fmt.Sprintf("%d", size), func(b *testing.B) {
541 set := make(StringSorted)
542 for i := 0; i < size; i++ {
543 set[fmt.Sprintf("val%d", i)] = struct{}{}
544 }
545
546 var buf bytes.Buffer
547 writer := msgp.NewWriter(&buf)
548
549 b.ReportAllocs()
550 b.ResetTimer()
551 for i := 0; i < b.N; i++ {
552 buf.Reset()
553 writer.Reset(&buf)
554 set.EncodeMsg(writer)
555 writer.Flush()
556 }
557 })
558 }
559}
560
561func BenchmarkStringSorted_DecodeMsg(b *testing.B) {
562 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…