[Libguestfs] [PATCH libnbd 7/9] golang: aio_buffer.go: Speed up FromBytes()

Eric Blake eblake at redhat.com
Tue Feb 8 20:50:55 UTC 2022


On Sun, Jan 30, 2022 at 01:33:35AM +0200, Nir Soffer wrote:
> Using Slice() we can use builtin copy() instead of a manual loop, which
> is 4.6 times faster with a typical 256k buffer:

Again, the benefits of the underlying libraries being able to
vectorize over larger chunks of memory ;)

> 
> Before:
> BenchmarkFromBytes-12            	    9806	    111474 ns/op
> 
> After:
> BenchmarkFromBytes-12            	   48193	     24106 ns/op
> 
> Signed-off-by: Nir Soffer <nsoffer at redhat.com>
> ---
>  golang/aio_buffer.go | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
>

ACK.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org




More information about the Libguestfs mailing list