Nir Soffer
2021-Nov-05 23:33 UTC
[Libguestfs] [PATCH nbdkit 1/4] common/utils/test-vector.c: Add vector benchmarks
On Sat, Nov 6, 2021 at 1:23 AM Nir Soffer <nsoffer at redhat.com> wrote:> > The generic vector reallocs on every append. Add benchmarks to measure > the cost with uint32 vector (used for copying extents) and the effect of > reserving space upfront. > > The tests show that realloc is pretty efficient, but calling reserve > before the appends speeds the appends up significantly. > > NBDKIT_BENCH=1 ./test-vector > bench_reserve: 1000000 appends in 0.004503 s > bench_append: 1000000 appends in 0.014986 s > > The new benchmarks do not run by default to avoid trouble in CI on > overloaded machines or under qemu emulation. > > A new target added to run all benchmaks: > > make bench > > Ported from libnbd: > - https://listman.redhat.com/archives/libguestfs/2021-October/msg00304.html > - https://listman.redhat.com/archives/libguestfs/2021-October/msg00305.html > --- > Makefile.am | 5 +++ > README | 7 ++++ > common/utils/Makefile.am | 3 ++ > common/utils/bench.h | 72 ++++++++++++++++++++++++++++++++++++++I forgot to add this file to the sources, so it is not included in the tarball. Wil fix this before pusing. I think including maintainer-check-extra-dist in the check target wil avoid such errors for very little cost: $ time make dist maintainer-check-extra-dist >/dev/null make: *** [Makefile:1173: maintainer-check-extra-dist] Error 1 real 0m3.767s user 0m2.655s sys 0m1.644s
Richard W.M. Jones
2021-Nov-06 08:30 UTC
[Libguestfs] [PATCH nbdkit 1/4] common/utils/test-vector.c: Add vector benchmarks
On Sat, Nov 06, 2021 at 01:33:29AM +0200, Nir Soffer wrote:> On Sat, Nov 6, 2021 at 1:23 AM Nir Soffer <nsoffer at redhat.com> wrote: > > > > The generic vector reallocs on every append. Add benchmarks to measure > > the cost with uint32 vector (used for copying extents) and the effect of > > reserving space upfront. > > > > The tests show that realloc is pretty efficient, but calling reserve > > before the appends speeds the appends up significantly. > > > > NBDKIT_BENCH=1 ./test-vector > > bench_reserve: 1000000 appends in 0.004503 s > > bench_append: 1000000 appends in 0.014986 s > > > > The new benchmarks do not run by default to avoid trouble in CI on > > overloaded machines or under qemu emulation. > > > > A new target added to run all benchmaks: > > > > make bench > > > > Ported from libnbd: > > - https://listman.redhat.com/archives/libguestfs/2021-October/msg00304.html > > - https://listman.redhat.com/archives/libguestfs/2021-October/msg00305.html > > --- > > Makefile.am | 5 +++ > > README | 7 ++++ > > common/utils/Makefile.am | 3 ++ > > common/utils/bench.h | 72 ++++++++++++++++++++++++++++++++++++++ > > I forgot to add this file to the sources, so it is not included in the tarball. > Wil fix this before pusing. > > I think including maintainer-check-extra-dist in the check target wil avoid > such errors for very little cost:This rule only works directly after running "make dist". Rich.> $ time make dist maintainer-check-extra-dist >/dev/null > make: *** [Makefile:1173: maintainer-check-extra-dist] Error 1 > > real 0m3.767s > user 0m2.655s > sys 0m1.644s-- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 100 libraries supported. http://fedoraproject.org/wiki/MinGW