Posted to tcl by kbk at Sun Nov 21 02:16:38 GMT 2010view raw

  1. $ ./tcltest
  2. % set i 0
  3. 0
  4. % time {set a [expr {[incr i]*1e-9}]x} 1000000
  5. 4.573238 microseconds per iteration
  6. % set tcl_precision 17
  7. 17
  8. % set i 0
  9. 0
  10. % time {set a [expr {[incr i]*1e-9}]x} 1000000
  11. 4.2633270000000003 microseconds per iteration
  12. % set tcl_precision 12
  13. 12
  14. % set i 0
  15. 0
  16. % time {set a [expr {[incr i]*1e-9}]x} 1000000
  17. 4.001461 microseconds per iteration
  18. % exit
  19.  
  20. $ tclsh8.5
  21. % set i 0
  22. 0
  23. % time {set a [expr {[incr i]*1e-9}]x} 1000000; # horrible before the fix
  24. 28.523233 microseconds per iteration
  25. % set tcl_precision 17
  26. 17
  27. % set i 0
  28. 0
  29. % time {set a [expr {[incr i]*1e-9}]x} 1000000
  30. 5.4804399999999998 microseconds per iteration
  31. % set tcl_precision 12
  32. 12
  33. % set i 0
  34. 0
  35. % time {set a [expr {[incr i]*1e-9}]x} 1000000
  36. 5.202241 microseconds per iteration
  37. % exit