From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:36490) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RDAVj-0006ib-LL for qemu-devel@nongnu.org; Mon, 10 Oct 2011 03:42:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RDAVi-0004ux-LD for qemu-devel@nongnu.org; Mon, 10 Oct 2011 03:42:55 -0400 Received: from mail-ww0-f53.google.com ([74.125.82.53]:62782) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RDAVi-0004uh-Bb for qemu-devel@nongnu.org; Mon, 10 Oct 2011 03:42:54 -0400 Received: by wwg14 with SMTP id 14so7414248wwg.10 for ; Mon, 10 Oct 2011 00:42:53 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <4E92A1FB.70706@redhat.com> Date: Mon, 10 Oct 2011 09:42:51 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <20111009235629.GB9542@redhat.com> In-Reply-To: <20111009235629.GB9542@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH RFC] qemu-file: output data directly if possible List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: qemu-devel@nongnu.org On 10/10/2011 01:56 AM, Michael S. Tsirkin wrote: > qemu file currently always buffers up data before writing it out. > At least for memory this is probably not a good idea: > writing out to file would be cheaper. Let's do > that if we can, which should be the common case. If we can't, buffer. > > Signed-off-by: Michael S. Tsirkin > > --- > > Completely untested, this is just thinking aloud. > Shouldn't the below save us a data copy in the > common case, helping speed up migration? The problem here is qemu_put_byte and friends, where the indirection of a function call would probably slow things down. In the common case, qemu_put_byte is called a lot and f->buf_index would not be zero. The way to go would probably be to merge QEMUFile and QEMUBufferedFile's two buffering layers, which also removes a copy. Paolo