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

Function BenchmarkReadInt64

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

Source from the content-addressed store, hash-verified

581}
582
583func BenchmarkReadInt64(b *testing.B) {
584 is := []int64{0, 1, 65000, rand.Int63()}
585 data := make([]byte, 0, 9*len(is))
586 for _, n := range is {
587 data = AppendInt64(data, n)
588 }
589 rd := NewReader(NewEndlessReader(data, b))
590 b.SetBytes(int64(len(data) / len(is)))
591 b.ReportAllocs()
592 b.ResetTimer()
593 for i := 0; i < b.N; i++ {
594 _, err := rd.ReadInt64()
595 if err != nil {
596 b.Fatal(err)
597 }
598 }
599}
600
601func BenchmarkReadUintWithInt64(b *testing.B) {
602 us := []uint64{0, 1, 10000, uint64(rand.Uint32() * 4)}

Callers

nothing calls this directly

Calls 4

ReadInt64Method · 0.95
AppendInt64Function · 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…