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>
This commit is contained in:
6
gitk
6
gitk
@ -2616,6 +2616,7 @@ proc layoutmore {tmax allread} {
|
|||||||
proc showstuff {canshow last} {
|
proc showstuff {canshow last} {
|
||||||
global numcommits commitrow pending_select selectedline curview
|
global numcommits commitrow pending_select selectedline curview
|
||||||
global lookingforhead mainheadid displayorder nullid selectfirst
|
global lookingforhead mainheadid displayorder nullid selectfirst
|
||||||
|
global lastscrollset
|
||||||
|
|
||||||
if {$numcommits == 0} {
|
if {$numcommits == 0} {
|
||||||
global phase
|
global phase
|
||||||
@ -2623,8 +2624,13 @@ proc showstuff {canshow last} {
|
|||||||
allcanvs delete all
|
allcanvs delete all
|
||||||
}
|
}
|
||||||
set r0 $numcommits
|
set r0 $numcommits
|
||||||
|
set prev $numcommits
|
||||||
set numcommits $canshow
|
set numcommits $canshow
|
||||||
|
set t [clock clicks -milliseconds]
|
||||||
|
if {$prev < 100 || $last || $t - $lastscrollset > 500} {
|
||||||
|
set lastscrollset $t
|
||||||
setcanvscroll
|
setcanvscroll
|
||||||
|
}
|
||||||
set rows [visiblerows]
|
set rows [visiblerows]
|
||||||
set r1 [lindex $rows 1]
|
set r1 [lindex $rows 1]
|
||||||
if {$r1 >= $canshow} {
|
if {$r1 >= $canshow} {
|
||||||
|
Reference in New Issue
Block a user