From patchwork Wed Jan 8 09:08:36 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Lieven X-Patchwork-Id: 308141 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 8468E2C0098 for ; Wed, 8 Jan 2014 21:04:25 +1100 (EST) Received: from localhost ([::1]:45649 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W0p7X-0005BZ-21 for incoming@patchwork.ozlabs.org; Wed, 08 Jan 2014 04:08:15 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38973) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W0p6u-0005BM-J0 for qemu-devel@nongnu.org; Wed, 08 Jan 2014 04:07:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W0p6p-0006c8-1L for qemu-devel@nongnu.org; Wed, 08 Jan 2014 04:07:36 -0500 Received: from mx.ipv6.kamp.de ([2a02:248:0:51::16]:42430 helo=mx01.kamp.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W0p6o-0006bX-NJ for qemu-devel@nongnu.org; Wed, 08 Jan 2014 04:07:30 -0500 Received: (qmail 9003 invoked by uid 89); 8 Jan 2014 09:07:28 -0000 Received: from [82.141.1.145] by client-16-kamp (envelope-from , uid 89) with qmail-scanner-2010/03/19-MF (clamdscan: 0.98/18325. hbedv: 8.2.12.166/7.11.123.254. spamassassin: 3.3.1. Clear:RC:1(82.141.1.145):SA:0(-1.5/5.0):. Processed in 1.195525 secs); 08 Jan 2014 09:07:28 -0000 Received: from ns.kamp-intra.net (HELO dns.kamp-intra.net) ([82.141.1.145]) by mx01.kamp.de with SMTP; 8 Jan 2014 09:07:26 -0000 X-GL_Whitelist: yes Received: from lieven-pc.kamp-intra.net (lieven-pc.kamp-intra.net [172.21.12.60]) by dns.kamp-intra.net (Postfix) with ESMTP id A2280206AC; Wed, 8 Jan 2014 10:06:56 +0100 (CET) Received: by lieven-pc.kamp-intra.net (Postfix, from userid 1000) id D0A80610EF; Wed, 8 Jan 2014 10:08:38 +0100 (CET) From: Peter Lieven To: qemu-devel@nongnu.org Date: Wed, 8 Jan 2014 10:08:36 +0100 Message-Id: <1389172118-25402-5-git-send-email-pl@kamp.de> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1389172118-25402-1-git-send-email-pl@kamp.de> References: <1389172118-25402-1-git-send-email-pl@kamp.de> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a02:248:0:51::16 Cc: sw@weilnetz.de, Peter Lieven , xiawenc@linux.vnet.ibm.com, aliguori@amazon.com Subject: [Qemu-devel] [PATCHv4 4/6] ui/vnc: optimize clearing in find_and_clear_dirty_height() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org The following artifical test (just the bitmap operation part) running vnc_update_client 65536 times on a 2560x2048 surface illustrates the performance difference: All bits clean - vnc_update_client_new: 0.07 secs vnc_update_client_new2: 0.07 secs vnc_update_client_old: 10.98 secs All bits dirty - vnc_update_client_new: 11.26 secs - vnc_update_client_new2: 0.29 secs vnc_update_client_old: 20.19 secs Few bits dirty - vnc_update_client_new: 0.07 secs - vnc_update_client_new2: 0.07 secs vnc_update_client_old: 10.98 secs vnc_update_client_new2 shows the performance of vnc_update_client with this patch added. Comparing with the test run of the last patch the performance is at least unchanged while it is significantly improved for the all bits dirty case. Signed-off-by: Peter Lieven Reviewed-by: Wenchao Xia --- ui/vnc.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/ui/vnc.c b/ui/vnc.c index 3412cdf..4117230 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -879,13 +879,10 @@ static int find_and_clear_dirty_height(struct VncState *vs, int h; for (h = 1; h < (height - y); h++) { - int tmp_x; if (!test_bit(last_x, vs->dirty[y + h])) { break; } - for (tmp_x = last_x; tmp_x < x; tmp_x++) { - clear_bit(tmp_x, vs->dirty[y + h]); - } + bitmap_clear(vs->dirty[y + h], last_x, x - last_x); } return h;