Re: [Libguestfs] [libnbd PATCH] python: Speed up pread

2022-05-31 Thread Eric Blake
On Sat, May 28, 2022 at 06:16:21PM +0100, Richard W.M. Jones wrote: > On Fri, May 27, 2022 at 04:44:16PM -0500, Eric Blake wrote: > > Instead of malloc'ing a C buffer, nbd_pread()ing into it, then copying > > it into an immutable Python bytes object, we can instead pre-create a > > correctly-sized

Re: [Libguestfs] [libnbd PATCH] python: Speed up pread

2022-05-28 Thread Richard W.M. Jones
On Fri, May 27, 2022 at 04:44:16PM -0500, Eric Blake wrote: > Instead of malloc'ing a C buffer, nbd_pread()ing into it, then copying > it into an immutable Python bytes object, we can instead pre-create a > correctly-sized Python bytearray object, then nbd_pread() directly > into that object's

Re: [Libguestfs] [libnbd PATCH] python: Speed up pread

2022-05-27 Thread Eric Blake
On Fri, May 27, 2022 at 04:44:16PM -0500, Eric Blake wrote: > Instead of malloc'ing a C buffer, nbd_pread()ing into it, then copying > it into an immutable Python bytes object, we can instead pre-create a > correctly-sized Python bytearray object, then nbd_pread() directly > into that object's

[Libguestfs] [libnbd PATCH] python: Speed up pread

2022-05-27 Thread Eric Blake
Instead of malloc'ing a C buffer, nbd_pread()ing into it, then copying it into an immutable Python bytes object, we can instead pre-create a correctly-sized Python bytearray object, then nbd_pread() directly into that object's underlying bytes. While the data copying might not be the bottleneck