Posted to tcl by Stu at Sat Oct 31 17:05:25 GMT 2020view raw
- namespace eval n {
- proc z {elem incr} {
- variable a
- set a($elem) [expr {$a($elem) + $incr}]
- }
- proc go {} {
- timerate -calibrate {}
- interp alias {} ::n::goa {} ::n::z q
- namespace ensemble create -map {goe {z q}}
- variable a
- unset -nocomplain a
- set a(q) 1
- set ta [lindex [timerate {goa 3}] 0]
- unset -nocomplain a
- set a(q) 1
- set te [lindex [timerate {n goe 3}] 0]
- list a:$ta e:$te
- }
- }
- puts [n::go]
- My result: a:3.557854 e:3.406559