[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] xbzrle: don't check the value in the vm ram rep
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH] xbzrle: don't check the value in the vm ram repeatedly |
Date: |
Sat, 29 Mar 2014 09:38:32 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 |
On 03/29/2014 09:12 AM, 陈梁 wrote:
> /* word at a time for speed */
> if (!res) {
> while (i < slen &&
> (*(long *)(old_buf + i)) == (*(long *)(new_buf + i))) {
> i += sizeof(long);
> zrun_len += sizeof(long);
> }
>
> /* go over the rest */
> //while (i < slen && old_buf[i] == new_buf[i]) {
> // zrun_len++;
> // i++;
> //}
> }
> i += sizeof(long);
> nzrun_len += sizeof(long);
That does not produce a minimal compression (it treats all 8 bytes as
different, even if 7 of them were the same). It might be a viable
solution if the extra overhead of the additional bytes sent over the
wire is less than the overhead saved by not re-checking the temporary
variable to determine a better compression. But I'm not convinced - it
seems that reading memory into a register, then doing multiple
operations on that cached value, will be a win (that is, minimal
compression matters, because time spent transmitting bytes over the
network is slower than time spent calculating how to avoid bytes to
transmit).
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature