Jim DeVona [L1 ]
[L2 ] Here is a benchmark procedure I use as a simple alternative to the bench package for quick timing comparison tests:
# # Parameters: # script, the code to benchmark. Executed in caller's context. # iterations, number of times to execute script. Defaults to 1. # # Returns: # a two-element list reporting the average iteration time to execute script # and the total elapsed time in microseconds. # proc benchmark {script {iterations 1}} { set start [clock microseconds] set average [uplevel 1 [list time $script $iterations]] set end [clock microseconds] set total [expr {$end - $start}] return [list [lindex $average 0] $total] }