On Fri, Feb 11, 2022 at 03:21:21AM +0200, Nir Soffer wrote:
Add unit tests and benchmarks for AioBuffer. The tests are trivial
but
they server as running documentation, and they point out important
serve
details about the type.
The benchmarks show the efficiency of allocating a new buffer, zeroing
it, and interfacing with Go code.
These tests will also ensure that we don't break anything by the next
changes.
To run the benchmarks use:
$ go test -run=xxx -bench=.
goos: linux
goarch: amd64
pkg:
libguestfs.org/libnbd
cpu: Intel(R) Core(TM) i7-10850H CPU @ 2.70GHz
BenchmarkMakeAioBuffer-12 6871759 157.2 ns/op
BenchmarkAioBufferZero-12 17551 69552 ns/op
BenchmarkFromBytes-12 9632 139112 ns/op
BenchmarkAioBufferBytes-12 69375 16410 ns/op
PASS
ok
libguestfs.org/libnbd 5.843s
To make sure the benchmarks will not break, we run them in "make check"
with a very short timeout. For actual performance testing run "go test"
directly.
Sounds good to me.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization:
qemu.org |
libvirt.org