From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51313) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c1tW0-0002dp-Dp for qemu-devel@nongnu.org; Wed, 02 Nov 2016 07:15:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c1tVz-0004ZX-7m for qemu-devel@nongnu.org; Wed, 02 Nov 2016 07:15:32 -0400 Date: Wed, 2 Nov 2016 12:15:24 +0100 From: Kevin Wolf Message-ID: <20161102111524.GE6182@noname.redhat.com> References: <20161012204907.25941-1-mreitz@redhat.com> <20161012204907.25941-3-mreitz@redhat.com> <7be11d16-d2ae-e892-5f97-17f971859a3a@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7be11d16-d2ae-e892-5f97-17f971859a3a@linux.vnet.ibm.com> Subject: Re: [Qemu-devel] [PATCH 2/3] block: Emit modules in bdrv_iterate_format() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Hao QingFeng Cc: Max Reitz , qemu-block@nongnu.org, qemu-devel@nongnu.org, Stefan Hajnoczi 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