The previous commit improved performance a lot but also meant that
we waited longer to see something drawn. This refines the heuristics
for when to call update so that (1) when we have finished processing
a bufferfull of information from git-rev-list, we call update if
enough time has elapsed, regardless of how many commits we've drawn,
and (2) the number of commits drawn between updates scales with the
total number of commits drawn: 1 for 1-99 commits, 10 for 100-9999
commits, or 100 for >= 10000 commits.
set phase getcommits
set startmsecs [clock clicks -milliseconds]
set nextupdate [expr $startmsecs + 100]
set phase getcommits
set startmsecs [clock clicks -milliseconds]
set nextupdate [expr $startmsecs + 100]
if [catch {
set parse_args [concat --default HEAD $rargs]
set parsed_args [split [eval exec git-rev-parse $parse_args] "\n"]
if [catch {
set parse_args [concat --default HEAD $rargs]
set parsed_args [split [eval exec git-rev-parse $parse_args] "\n"]
global commits parents cdate children nchildren
global commitlisted phase commitinfo nextupdate
global stopped redisplaying leftover
global commits parents cdate children nchildren
global commitlisted phase commitinfo nextupdate
global stopped redisplaying leftover
- global numcommits ncmupdate
set stuff [read $commfd]
if {$stuff == {}} {
set stuff [read $commfd]
if {$stuff == {}} {
set commitlisted($id) 1
parsecommit $id $cmit 1
drawcommit $id
set commitlisted($id) 1
parsecommit $id $cmit 1
drawcommit $id
- if {[clock clicks -milliseconds] >= $nextupdate
- && $numcommits >= $ncmupdate + 100} {
- doupdate
- set ncmupdate $numcommits
+ if {[clock clicks -milliseconds] >= $nextupdate} {
+ doupdate 1
}
while {$redisplaying} {
set redisplaying 0
}
while {$redisplaying} {
set redisplaying 0
foreach id $commits {
drawcommit $id
if {$stopped} break
foreach id $commits {
drawcommit $id
if {$stopped} break
- if {[clock clicks -milliseconds] >= $nextupdate
- && $numcommits >= $ncmupdate + 100} {
- doupdate
- set ncmupdate $numcommits
+ if {[clock clicks -milliseconds] >= $nextupdate} {
+ doupdate 1
-proc doupdate {} {
- global commfd nextupdate
+proc doupdate {reading} {
+ global commfd nextupdate numcommits ncmupdate
- incr nextupdate 100
- fileevent $commfd readable {}
+ if {$reading} {
+ fileevent $commfd readable {}
+ }
- fileevent $commfd readable [list getcommitlines $commfd]
+ set nextupdate [expr {[clock clicks -milliseconds] + 100}]
+ if {$numcommits < 100} {
+ set ncmupdate [expr {$numcommits + 1}]
+ } elseif {$numcommits < 10000} {
+ set ncmupdate [expr {$numcommits + 10}]
+ } else {
+ set ncmupdate [expr {$numcommits + 100}]
+ }
+ if {$reading} {
+ fileevent $commfd readable [list getcommitlines $commfd]
+ }
}
if {[clock clicks -milliseconds] >= $nextupdate
&& $numcommits >= $ncmupdate} {
}
if {[clock clicks -milliseconds] >= $nextupdate
&& $numcommits >= $ncmupdate} {
- doupdate
- set ncmupdate $numcommits
if {$startcommits == {}} return
set startmsecs [clock clicks -milliseconds]
set nextupdate [expr $startmsecs + 100]
if {$startcommits == {}} return
set startmsecs [clock clicks -milliseconds]
set nextupdate [expr $startmsecs + 100]
initgraph
set todo [lindex $startcommits 0]
drawrest 0 1
initgraph
set todo [lindex $startcommits 0]
drawrest 0 1
drawslants $level
}
if {[clock clicks -milliseconds] >= $nextupdate
drawslants $level
}
if {[clock clicks -milliseconds] >= $nextupdate
- && $numcommits >= $ncmupdate + 100} {
- update
- incr nextupdate 100
- set ncmupdate $numcommits
+ && $numcommits >= $ncmupdate} {
+ doupdate 0