Posted to tcl by Ro at Sun Mar 04 02:53:39 GMT 2007view raw

  1.  
  2.  
  3. # Gets slower and slower as you move up in versions!
  4. #
  5. # 13s on 8.3.2
  6. # 15s on 8.3.5
  7. # 26s on 8.4.13
  8. # 31s on 8.5a4
  9. #
  10. # WinXP SP2 Sempron 3000+, March 3rd, 2007
  11.  
  12.  
  13.  
  14. console show
  15.  
  16. puts $tcl_patchLevel
  17.  
  18.  
  19. proc up1timer {body} {
  20. set begin_time [clock seconds]
  21. uplevel $body
  22. set end_time [clock seconds]
  23. set time_elapsed [expr $end_time - $begin_time]
  24. puts "**elapsed $time_elapsed s**"
  25. }
  26.  
  27.  
  28. label .e -text go! -bg red -fg white
  29. pack .e -fill x -expand 1
  30.  
  31.  
  32.  
  33. proc get_countries {} {
  34. set countries {}
  35. for {set i 0} {$i < 800} {incr i} {
  36. set x [clock clicks]_[clock seconds]
  37. lappend countries alphabetica_$x
  38. }
  39. return $countries
  40. }
  41.  
  42. up1timer {
  43.  
  44. set countries {}
  45. for {set i 0} {$i<3000} {incr i} {
  46. set x [get_countries]
  47. foreach el $x {lappend countries $el}
  48. .e conf -text $i ; update
  49. }
  50.  
  51.  
  52. }
  53.  

Comments

Posted by miguel at Sun Mar 04 12:59:10 GMT 2007 [text] [code]

Please compare to http://paste.tclers.tk/167