From patchwork Sun Jan 5 18:02:29 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Lieven X-Patchwork-Id: 307005 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 6E27D2C00C6 for ; Mon, 6 Jan 2014 05:02:43 +1100 (EST) Received: from localhost ([::1]:58897 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vzs24-0005N7-GE for incoming@patchwork.ozlabs.org; Sun, 05 Jan 2014 13:02:40 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:32801) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vzs12-0004di-5l for qemu-devel@nongnu.org; Sun, 05 Jan 2014 13:01:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vzs0t-0004ct-5j for qemu-devel@nongnu.org; Sun, 05 Jan 2014 13:01:36 -0500 Received: from mx.ipv6.kamp.de ([2a02:248:0:51::16]:51819 helo=mx01.kamp.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vzs0s-0004cR-RL for qemu-devel@nongnu.org; Sun, 05 Jan 2014 13:01:27 -0500 Received: (qmail 1243 invoked by uid 89); 5 Jan 2014 18:01:26 -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/18317. hbedv: 8.2.12.166/7.11.123.168. spamassassin: 3.3.1. Clear:RC:1(82.141.1.145):SA:0(-1.2/5.0):. Processed in 10.087862 secs); 05 Jan 2014 18:01:26 -0000 Received: from ns.kamp-intra.net (HELO dns.kamp-intra.net) ([82.141.1.145]) by mx01.kamp.de with SMTP; 5 Jan 2014 18:01:15 -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 5A2FD206AC; Sun, 5 Jan 2014 19:00:55 +0100 (CET) Received: by lieven-pc.kamp-intra.net (Postfix, from userid 1000) id E09CD5FD4C; Sun, 5 Jan 2014 19:02:32 +0100 (CET) From: Peter Lieven To: qemu-devel@nongnu.org Date: Sun, 5 Jan 2014 19:02:29 +0100 Message-Id: <1388944951-14767-5-git-send-email-pl@kamp.de> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1388944951-14767-1-git-send-email-pl@kamp.de> References: <1388944951-14767-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 , aliguori@amazon.com Subject: [Qemu-devel] [PATCHv3 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 --- ui/vnc.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/ui/vnc.c b/ui/vnc.c index 6a0c03e..980df34 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -876,13 +876,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;