summaryrefslogtreecommitdiff
path: root/gitk
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2006-10-31 04:00:53 (GMT)
committerPaul Mackerras <paulus@samba.org>2007-06-23 10:58:06 (GMT)
commita2c22362cc2c0bb0451bc8098b3ba0c9353ebe02 (patch)
treefe5336976069b666488eefc303ab2ca2d80cd2f3 /gitk
parent6fb735aedb25eade3d523053cb05c030a1cc06b3 (diff)
downloadgit-a2c22362cc2c0bb0451bc8098b3ba0c9353ebe02.zip
git-a2c22362cc2c0bb0451bc8098b3ba0c9353ebe02.tar.gz
git-a2c22362cc2c0bb0451bc8098b3ba0c9353ebe02.tar.bz2
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>
Diffstat (limited to 'gitk')
-rwxr-xr-xgitk8
1 files changed, 7 insertions, 1 deletions
diff --git a/gitk b/gitk
index d6ed4f6..d5b71dd 100755
--- a/gitk
+++ b/gitk
@@ -2616,6 +2616,7 @@ proc layoutmore {tmax allread} {
proc showstuff {canshow last} {
global numcommits commitrow pending_select selectedline curview
global lookingforhead mainheadid displayorder nullid selectfirst
+ global lastscrollset
if {$numcommits == 0} {
global phase
@@ -2623,8 +2624,13 @@ proc showstuff {canshow last} {
allcanvs delete all
}
set r0 $numcommits
+ set prev $numcommits
set numcommits $canshow
- setcanvscroll
+ set t [clock clicks -milliseconds]
+ if {$prev < 100 || $last || $t - $lastscrollset > 500} {
+ set lastscrollset $t
+ setcanvscroll
+ }
set rows [visiblerows]
set r1 [lindex $rows 1]
if {$r1 >= $canshow} {