Re: [Qemu-block] [PATCH 2/3] block: Emit modules in bdrv_iterate_format()
在 2016-11-02 19:15, Kevin Wolf 写道: Am 02.11.2016 um 11:52 hat Hao QingFeng geschrieben: Sorry for a bit late response. The function looks fine but just some doubt on g_renew in this piece of code(and the legacy), does g_renew(realloc) has much performance impact if it's call many times since alloc and memory copy are both also run many times? So how about increase the memory for more instead of 1 each time? formats = g_renew(const char *, formats, count + 10); A new counter also needs to be introduced to record the space size. This code is not on a hot path, so keeping the code simple and easy to maintain is preferrable to complicating it just so --help can save a few CPU cycles. Got it. thanks! Kevin -- QingFeng Hao(Robin)
Re: [Qemu-block] [PATCH 2/3] block: Emit modules in bdrv_iterate_format()
Am 02.11.2016 um 11:52 hat Hao QingFeng geschrieben: > Sorry for a bit late response. The function looks fine but just some > doubt on g_renew in this piece of code(and the legacy), does > g_renew(realloc) has much performance impact if it's call many times > since alloc and memory copy are both also run many times? So how > about increase the memory for more instead of 1 each time? > > formats = g_renew(const char *, formats, count + 10); > > A new counter also needs to be introduced to record the space size. This code is not on a hot path, so keeping the code simple and easy to maintain is preferrable to complicating it just so --help can save a few CPU cycles. Kevin