# ========================================================= # tcloo performance test ::oo::class create tclooC { variable val1 val2 val3 constructor { arg1 arg2 arg3 } { set val1 $arg1 set val2 $arg2 set val3 $arg3 } method getVal {} { return "$val1-$val2-$val3" } method getVal1 {} { set val1 } } > ::tclooC # create instance set tclooRef [tclooC new abc 123 xyz] > ::oo::Obj22 # setup direct access namespace upvar $tclooRef val1 val1 > # ========================================================= # START test # performance test 1: create/delete instance time { [tclooC new abc 123 xyz] destroy } 1000 > 33.758 microseconds per iteration # performance test 2: call instance method time { $tclooRef getVal } 1000 > 11.211 microseconds per iteration # performance test 3: direct access instance attribute time { set val1 } 1000 > 2.295 microseconds per iteration