Posted to tcl by dgp at Thu Jul 25 05:14:23 GMT 2013view raw

  1. % set script {
  2. set f 1e-200
  3. for {set ct $argv} {$ct > 0} {incr ct -1} {
  4. set f [expr {$f * 1.0000017}]
  5. }
  6. }
  7.  
  8. set f 1e-200
  9. for {set ct $argv} {$ct > 0} {incr ct -1} {
  10. set f [expr {$f * 1.0000017}]
  11. }
  12.  
  13. % set argv 1000
  14. 1000
  15. % time $script 100
  16. 589.52672 microseconds per iteration
  17. % time $script 1000
  18. 526.182627 microseconds per iteration
  19. % proc demo argv $script
  20. % time {demo $argv} 1000
  21. 135.619865 microseconds per iteration
  22.