Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 5b1c2e21820a93e1169f1fde0144b43716058d5d
Ticket: 3380073fffffffffffffffffffffffffffffffff
declining [expr] performance
User & Date: cyan on 2011-07-29 22:13:53
Changes

  1. icomment:
    Another interesting result:  I changed my benchmark script to build the looping machinery and tested command as a string, run it as a lambda, and allow loop unrolling: http://65.111.161.125/benchmark_unrolled.tcl
    
    Benchmarked code here: http://65.111.161.125/run_benchmark.tcl
    
    Now 8.6 is consistently faster for me (~5-20%), for low values of unroll.
    When unroll reaches around 5 8.5 starts to pull ahead (about 5%)
    
    tcl8.5.9, unroll 1: 3.693 usec per iteration
    tcl8.6b1.2, unroll 1: 3.505 usec per iteration 
    
    tcl8.5.9, unroll 2: 3.724 usec per iteration
    tcl8.6b1.2, unroll 2: 3.470 usec per iteration
    
    tcl8.5.9, unroll 5: 3.359 usec per iteration
    tcl8.6b1.2, unroll 5: 3.444 usec per iteration
    
    The code is being run like so:
    set run "
        set rtimes  {}
        set start   \[clock microseconds\]
        while {\[incr i\] <= $it_a} {
            set j   0
            lappend rtimes  \[clock microseconds\]
            while {\[incr j\] <= [/ $it_b $unroll]} {
                [string repeat $args\n\t\t\t\t\t $unroll]
            }
            lappend rtimes  \[clock microseconds\]
        }
        set runtime     \[- \[clock microseconds\] \$start\]
        list \$rtimes \$runtime
    "
    lassign [apply [list {} $run [namespace current]]] rtimes runtime
    
    
    
    
  2. login: "cyan"
  3. mimetype: "text/plain"
  4. username: "cyan"