From mboxrd@z Thu Jan 1 00:00:00 1970 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 From: Peter Lieven Date: Wed, 8 Jan 2014 10:08:36 +0100 Message-Id: <1389172118-25402-5-git-send-email-pl@kamp.de> In-Reply-To: <1389172118-25402-1-git-send-email-pl@kamp.de> References: <1389172118-25402-1-git-send-email-pl@kamp.de> Subject: [Qemu-devel] [PATCHv4 4/6] ui/vnc: optimize clearing in find_and_clear_dirty_height() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: sw@weilnetz.de, Peter Lieven , xiawenc@linux.vnet.ibm.com, aliguori@amazon.com 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 --- 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; -- 1.7.9.5