From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37165) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WTvLJ-0001Ir-Aq for qemu-devel@nongnu.org; Sat, 29 Mar 2014 11:38:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WTvLE-0005od-Bw for qemu-devel@nongnu.org; Sat, 29 Mar 2014 11:38:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:3958) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WTvLE-0005oY-3K for qemu-devel@nongnu.org; Sat, 29 Mar 2014 11:38:40 -0400 Message-ID: <5336E8F8.5040107@redhat.com> Date: Sat, 29 Mar 2014 09:38:32 -0600 From: Eric Blake MIME-Version: 1.0 References: <1396079541-7112-1-git-send-email-arei.gonglei@huawei.com> <5336D059.2080106@redhat.com> <118C69AB-F17E-41B6-AFEF-5C1C02E345C9@icloud.com> <5336D7FE.5050904@redhat.com> In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="tuwK5VOXjX46ulks8xJfME7pa578aRNkN" Subject: Re: [Qemu-devel] [PATCH] xbzrle: don't check the value in the vm ram repeatedly List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?B?6ZmI5qKB?= Cc: ChenLiang , weidong.huang@huawei.com, quintela@redhat.com, qemu-devel@nongnu.org, dgilbert@redhat.com, owasserm@redhat.com, arei.gonglei@huawei.com, mrhines@us.ibm.com, pbonzini@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --tuwK5VOXjX46ulks8xJfME7pa578aRNkN Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 03/29/2014 09:12 AM, =E9=99=88=E6=A2=81 wrote: > /* word at a time for speed */ > if (!res) { > while (i < slen && > (*(long *)(old_buf + i)) =3D=3D (*(long *)(new_buf + = i))) { > i +=3D sizeof(long); > zrun_len +=3D sizeof(long); > } >=20 > /* go over the rest */ > //while (i < slen && old_buf[i] =3D=3D new_buf[i]) { > // zrun_len++; > // i++; > //} > } > i +=3D sizeof(long); > nzrun_len +=3D 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). --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --tuwK5VOXjX46ulks8xJfME7pa578aRNkN Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJTNuj4AAoJEKeha0olJ0NqCMYH/Ak9qdmST0o8wsukf0iXNKG8 IM5NPTMrbXyHUFNQ459OGU+hVOWoSEAHprdBF0TFybKjjKW8pTVBNpKnx6BUQOQf XUw9ouhb+4k3qWtdebUFQFdVsN8ZNOY0cXQs7hbC1BO24YgtHC6nJZ0Q/5giePDZ MapV1Eqn880UsIqaOSxA0QuBck/mV925XAE5VzQpILPgoliyc5cjQkkk0RbsH0++ 9VSsXQiWOF5I8UJMMyGAQiFMVvIqHY96wpIfb4yXQYefSax1aHicP6feJzYuRl5K NDUezCdGepF/sbAHLS9cgwutiwtBfjMJbW0U+LtLHLxDVRFWjUwlrPTdtPeaNLs= =PlpI -----END PGP SIGNATURE----- --tuwK5VOXjX46ulks8xJfME7pa578aRNkN--