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

Function BenchmarkSkipBytes

msgp/read_bytes_test.go:727–761  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

725}
726
727func BenchmarkSkipBytes(b *testing.B) {
728 var buf bytes.Buffer
729 en := NewWriter(&buf)
730 en.WriteMapHeader(6)
731
732 en.WriteString("thing_one")
733 en.WriteString("value_one")
734
735 en.WriteString("thing_two")
736 en.WriteFloat64(3.14159)
737
738 en.WriteString("some_bytes")
739 en.WriteBytes([]byte("nkl4321rqw908vxzpojnlk2314rqew098-s09123rdscasd"))
740
741 en.WriteString("the_time")
742 en.WriteTime(time.Now())
743
744 en.WriteString("what?")
745 en.WriteBool(true)
746
747 en.WriteString("ext")
748 en.WriteExtension(&RawExtension{Type: 55, Data: []byte("raw data!!!")})
749 en.Flush()
750
751 bts := buf.Bytes()
752 b.SetBytes(int64(len(bts)))
753 b.ReportAllocs()
754 b.ResetTimer()
755 for i := 0; i < b.N; i++ {
756 _, err := Skip(bts)
757 if err != nil {
758 b.Fatal(err)
759 }
760 }
761}

Callers

nothing calls this directly

Calls 10

WriteMapHeaderMethod · 0.95
WriteStringMethod · 0.95
WriteFloat64Method · 0.95
WriteBytesMethod · 0.95
WriteTimeMethod · 0.95
WriteBoolMethod · 0.95
WriteExtensionMethod · 0.95
FlushMethod · 0.95
NewWriterFunction · 0.85
SkipFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…