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

Function BenchmarkReadUint64

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

Source from the content-addressed store, hash-verified

645}
646
647func BenchmarkReadUint64(b *testing.B) {
648 us := []uint64{0, 1, 10000, uint64(rand.Uint32() * 4)}
649 data := make([]byte, 0, 9*len(us))
650 for _, n := range us {
651 data = AppendUint64(data, n)
652 }
653 rd := NewReader(NewEndlessReader(data, b))
654 b.SetBytes(int64(len(data) / len(us)))
655 b.ReportAllocs()
656 b.ResetTimer()
657 for i := 0; i < b.N; i++ {
658 _, err := rd.ReadUint64()
659 if err != nil {
660 b.Fatal(err)
661 }
662 }
663}
664
665func BenchmarkReadIntWithUint64(b *testing.B) {
666 is := []int64{0, 1, 65000, rand.Int63()}

Callers

nothing calls this directly

Calls 4

ReadUint64Method · 0.95
AppendUint64Function · 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…