Skip to content

Commit a2c2236

Browse files
committed
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 <[email protected]>
1 parent 6fb735a commit a2c2236

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

gitk

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2616,15 +2616,21 @@ proc layoutmore {tmax allread} {
26162616
proc showstuff {canshow last} {
26172617
global numcommits commitrow pending_select selectedline curview
26182618
global lookingforhead mainheadid displayorder nullid selectfirst
2619+
global lastscrollset
26192620

26202621
if {$numcommits == 0} {
26212622
global phase
26222623
set phase "incrdraw"
26232624
allcanvs delete all
26242625
}
26252626
set r0 $numcommits
2627+
set prev $numcommits
26262628
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+
}
26282634
set rows [visiblerows]
26292635
set r1 [lindex $rows 1]
26302636
if {$r1 >= $canshow} {

0 commit comments

Comments
 (0)