MCPcopy
hub / github.com/redis/go-redis / BenchmarkReader_ReadFloat

Function BenchmarkReader_ReadFloat

internal/proto/reader_test.go:87–101  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

85}
86
87func BenchmarkReader_ReadFloat(b *testing.B) {
88 buf := new(bytes.Buffer)
89 for i := 0; i < b.N; i++ {
90 fmt.Fprint(buf, ",123.456\r\n")
91 }
92 p := proto.NewReader(buf)
93 b.ResetTimer()
94
95 for i := 0; i < b.N; i++ {
96 _, err := p.ReadFloat()
97 if err != nil {
98 b.Fatal(err)
99 }
100 }
101}
102
103// loopFrameReader is an io.Reader that returns the same RESP frame over and
104// over without ever returning io.EOF. It lets the benchmark helpers below

Callers

nothing calls this directly

Calls 2

ReadFloatMethod · 0.95
NewReaderFunction · 0.92

Tested by

no test coverage detected