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

Function BenchmarkSkip

msgp/read_test.go:986–1022  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

984}
985
986func BenchmarkSkip(b *testing.B) {
987 var buf bytes.Buffer
988 en := NewWriter(&buf)
989 en.WriteMapHeader(6)
990
991 en.WriteString("thing_one")
992 en.WriteString("value_one")
993
994 en.WriteString("thing_two")
995 en.WriteFloat64(3.14159)
996
997 en.WriteString("some_bytes")
998 en.WriteBytes([]byte("nkl4321rqw908vxzpojnlk2314rqew098-s09123rdscasd"))
999
1000 en.WriteString("the_time")
1001 en.WriteTime(time.Now())
1002
1003 en.WriteString("what?")
1004 en.WriteBool(true)
1005
1006 en.WriteString("ext")
1007 en.WriteExtension(&RawExtension{Type: 55, Data: []byte("raw data!!!")})
1008 en.Flush()
1009
1010 bts := buf.Bytes()
1011 b.SetBytes(int64(len(bts)))
1012 b.ReportAllocs()
1013 b.ResetTimer()
1014
1015 rd := NewReader(NewEndlessReader(bts, b))
1016 for i := 0; i < b.N; i++ {
1017 err := rd.Skip()
1018 if err != nil {
1019 b.Fatal(err)
1020 }
1021 }
1022}
1023
1024func TestCopyNext(t *testing.T) {
1025 var buf bytes.Buffer

Callers

nothing calls this directly

Calls 12

WriteMapHeaderMethod · 0.95
WriteStringMethod · 0.95
WriteFloat64Method · 0.95
WriteBytesMethod · 0.95
WriteTimeMethod · 0.95
WriteBoolMethod · 0.95
WriteExtensionMethod · 0.95
FlushMethod · 0.95
SkipMethod · 0.95
NewWriterFunction · 0.85
NewReaderFunction · 0.85
NewEndlessReaderFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…