Posted to tcl by Stu at Sat Oct 31 17:05:25 GMT 2020view raw

  1. namespace eval n {
  2. proc z {elem incr} {
  3. variable a
  4. set a($elem) [expr {$a($elem) + $incr}]
  5. }
  6. proc go {} {
  7. timerate -calibrate {}
  8. interp alias {} ::n::goa {} ::n::z q
  9. namespace ensemble create -map {goe {z q}}
  10. variable a
  11. unset -nocomplain a
  12. set a(q) 1
  13. set ta [lindex [timerate {goa 3}] 0]
  14. unset -nocomplain a
  15. set a(q) 1
  16. set te [lindex [timerate {n goe 3}] 0]
  17. list a:$ta e:$te
  18. }
  19. }
  20. puts [n::go]
  21.  
  22.  
  23. My result: a:3.557854 e:3.406559