Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 3510aa11ee4aeab5bc34767307240fe2794a8a39
Ticket: 3380073fffffffffffffffffffffffffffffffff
declining [expr] performance
User & Date: msofer on 2011-07-29 19:32:22
Changes

  1. icomment:
    Interesting: this benchmarker loops calls from within TEBC, invoked as
       {*}$args
    IOW, it does sidestep my main beef with [time] (looping over Tcl_EvalObjEx calls) and is a better simulator of "real script behaviour". An even better (?) approach would compile a proc or lambda that contains a bc'ed loop over the script, and run that.
    
    The script mtime.tcl (attached) tries to separate that effect (proc mtime), and also to isolate the effect of the increased command call overhead in 8.6. On my machine I get
    
    mig@ari:~$ DEVEL/tcl-core/core-8-5/unix/tclsh /tmp/mtime.tcl
    tcl8.5.9: 
    [ time $cmd $n]: 1.93854 microseconds per iteration
    [mtime $cmd $n]: 1.81043 microseconds per iteration
    [mtime $scr $n]: 1.64805 microseconds per iteration
    mig@ari:~$ DEVEL/tcl-core/trunk/unix/tclsh /tmp/mtime.tcl
    tcl8.6b1.2: 
    [ time $cmd $n]: 2.21536 microseconds per iteration
    [mtime $cmd $n]: 1.98749 microseconds per iteration
    [mtime $scr $n]: 1.69049 microseconds per iteration
    
    Note that the first run is a plain [time], the second removes the Tcl_EvalObjEx overhead, the third removes the command call overhead. The script is very much ad-hoc, it is not so trivial to generalise either [mtime] nor [toBody] (it required removing [return] from [distance], for example).
    
    In the example then: most of the slowdown seems to be due to measurement problems ([time] is 8.6 unfriendly) and the increased command call overhead in 8.6 (itself mainly due to NRE).
    
    
  2. login: "msofer"
  3. mimetype: "text/plain"
  4. username: "msofer"