Posted to tcl by miguel at Sun Mar 04 12:58:30 GMT 2007view raw

  1. # Adapted from Ro's http://paste.tclers.tk/166
  2. #
  3. # * the original ran here in 32 secs 8.4.12, 54 secs in 8.5a4
  4. # * reduced to 1000 iterations: 9 vs 15 secs
  5. # * replaced [up1timer] with builtin [time]: no change
  6. # * removed all Tk code, ran this under different patchlevels:
  7. # 8.3.4 9 seconds
  8. # 8.4.12 9 seconds
  9. # 8.4.15 8 seconds
  10. # 8.5a4 15 seconds
  11. # 8.5a6 10 seconds
  12. #
  13. # Looks ok to me
  14. #
  15.  
  16.  
  17. puts $tcl_patchLevel
  18.  
  19. proc get_countries {} {
  20. set countries {}
  21. for {set i 0} {$i < 800} {incr i} {
  22. set x [clock clicks]_[clock seconds]
  23. lappend countries alphabetica_$x
  24. }
  25. return $countries
  26. }
  27.  
  28. set body {
  29. set countries {}
  30. for {set i 0} {$i<1000} {incr i} {
  31. set x [get_countries]
  32. foreach el $x {lappend countries $el}
  33. }
  34. }
  35.  
  36. set time [lindex [time $body] 0]
  37. puts "**elapsed [expr {$time/1000000}] seconds**"
  38.