Skip to content

Commit

Permalink
ui/vnc: optimize clearing in find_and_clear_dirty_height()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Wenchao Xia <[email protected]>
Signed-off-by: Gerd Hoffmann <[email protected]>
  • Loading branch information
plieven authored and kraxel committed Mar 10, 2014
1 parent 12b316d commit 863d7c9
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions ui/vnc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 863d7c9

Please sign in to comment.