On Tue, Feb 15, 2022 at 12:18 AM Nir Soffer <nsoffer@redhat.com> wrote:
On Mon, Feb 14, 2022 at 3:22 PM Eric Blake <eblake@redhat.com> wrote:
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
Fixed
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.
Thanks, I'll push tomorrow if you don't have more comments.
Pushed as 28137eea9b78ca32fce97f8c68483f447b861bc9..9099657ef541a635eae0d6d79080ad5bb0bc3281