From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48085) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WMzeD-0001GR-1Z for qemu-devel@nongnu.org; Mon, 10 Mar 2014 08:49:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WMze7-0000f9-4q for qemu-devel@nongnu.org; Mon, 10 Mar 2014 08:49:37 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51959) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WMze6-0000eq-Ri for qemu-devel@nongnu.org; Mon, 10 Mar 2014 08:49:31 -0400 From: Gerd Hoffmann Date: Mon, 10 Mar 2014 13:49:11 +0100 Message-Id: <1394455753-13783-8-git-send-email-kraxel@redhat.com> In-Reply-To: <1394455753-13783-1-git-send-email-kraxel@redhat.com> References: <1394455753-13783-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PULL 7/9] 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: Peter Lieven , Gerd Hoffmann , Anthony Liguori From: Peter Lieven 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 Signed-off-by: Gerd Hoffmann --- ui/vnc.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/ui/vnc.c b/ui/vnc.c index 1ed360a..e1d6ca3 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.8.3.1