On Tue, Feb 1, 2022 at 3:15 PM Eric Blake <eblake(a)redhat.com> wrote:
 On Sun, Jan 30, 2022 at 01:33:36AM +0200, Nir Soffer wrote:
 > Add benchmark for coping a buffer using 3 strategies - reusing same
 > buffer, making a new uninitialized buffer per copy, and using a zeroed
 > buffer per copy. This benchmark is the worst possible case, coping a
 copying
 > buffer to memory. Any real I/O will be much slower hiding the overhead
 > of allocating buffer or zeroed buffered.
 will be much slower, hiding the overhead of allocating or zeroing buffers.
 >
 > $ go test -run=AioBuffer -bench=Copy -benchtime=5s
 > goos: linux
 > goarch: amd64
 > pkg: 
libguestfs.org/libnbd
 > cpu: Intel(R) Core(TM) i7-10850H CPU @ 2.70GHz
 > BenchmarkAioBufferCopyBaseline-12      1142508              4523 ns/op
 > BenchmarkAioBufferCopyMake-12          1000000              5320 ns/op
 > BenchmarkAioBufferCopyMakeZero-12       728940              8218 ns/op
 >
 > Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
 > ---
 >  golang/libnbd_620_aio_buffer_test.go | 32 ++++++++++++++++++++++++++++
 >  1 file changed, 32 insertions(+)
 >
 > diff --git a/golang/libnbd_620_aio_buffer_test.go
b/golang/libnbd_620_aio_buffer_test.go
 > index 8f65b558..9ab411b3 100644
 > --- a/golang/libnbd_620_aio_buffer_test.go
 > +++ b/golang/libnbd_620_aio_buffer_test.go
 > @@ -195,10 +195,42 @@ func BenchmarkAioBufferBytes(b *testing.B) {
 >  func BenchmarkAioBufferSlice(b *testing.B) {
 >       buf := MakeAioBuffer(bufferSize)
 >       defer buf.Free()
 >       var r int
 >
 >       b.ResetTimer()
 Looks like you had a blank line with trailing whitespace in an earlier patch. 
I could not find a blank line with trailing whitespace in this series.
Did you finish reviewing this change? Richard already acked this, but
since this adds a new API, I would like to get more feedback.
Nir