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

Function BenchmarkReadFloat32

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

Source from the content-addressed store, hash-verified

408}
409
410func BenchmarkReadFloat32(b *testing.B) {
411 fs := []float32{rand.Float32(), rand.Float32(), rand.Float32(), rand.Float32()}
412 data := make([]byte, 0, 5*len(fs))
413 for _, f := range fs {
414 data = AppendFloat32(data, f)
415 }
416 rd := NewReader(NewEndlessReader(data, b))
417 b.SetBytes(5)
418 b.ReportAllocs()
419 b.ResetTimer()
420 for i := 0; i < b.N; i++ {
421 _, err := rd.ReadFloat32()
422 if err != nil {
423 b.Fatal(err)
424 }
425 }
426}
427
428func TestReadInt64(t *testing.T) {
429 var buf bytes.Buffer

Callers

nothing calls this directly

Calls 4

ReadFloat32Method · 0.95
AppendFloat32Function · 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…