@matheusbsbs / matheus-bagliano / commits / a2c22362cc
Fork 0

gitk: Limit how often we change the canvas scrolling region

For some unknown reason, changing the scrolling region on the canvases provokes multiple milliseconds worth of computation in the X server, and this can end up slowing gitk down significantly. This works around the problem by limiting the rate at which we update the scrolling region after the first 100 rows to at most 2 per second. Signed-off-by: Paul Mackerras <paulus@samba.org>

Paul Mackerras committed Oct 31, 2006 at 15:00 UTC a2c22362cc2c0bb0451bc8098b3ba0c9353ebe02
1 file changed +7 -1
gitk
+7 -1
@@ -2616,6 +2616,7 @@ proc layoutmore {tmax allread} {
2616 proc showstuff {canshow last} {
2617 global numcommits commitrow pending_select selectedline curview
2618 global lookingforhead mainheadid displayorder nullid selectfirst
2619 + global lastscrollset
2620
2621 if {$numcommits == 0} {
2622 global phase
@@ -2623,8 +2624,13 @@ proc showstuff {canshow last} {
2624 allcanvs delete all
2625 }
2626 set r0 $numcommits
2627 + set prev $numcommits
2628 set numcommits $canshow
2627 - setcanvscroll
2629 + set t [clock clicks -milliseconds]
2630 + if {$prev < 100 || $last || $t - $lastscrollset > 500} {
2631 + set lastscrollset $t
2632 + setcanvscroll
2633 + }
2634 set rows [visiblerows]
2635 set r1 [lindex $rows 1]
2636 if {$r1 >= $canshow} {