Posted to tcl by emiliano at Fri Feb 27 19:40:47 GMT 2009view raw
- emiliano@maq035:~$ cat withdict.tcl
- namespace eval foo {}
- for { set i 1 } { $i <= 100000 } { incr i } {
- dict set foo::mydict key_$i [string repeat A 1000]
- }
- puts "Dict: [exec pmap [pid] | grep total]"
- emiliano@maq035:~$ cat withonens.tcl
- namespace eval foo {}
- for { set i 1 } { $i <= 100000 } { incr i } {
- set foo::var_$i [string repeat A 1000]
- }
- puts "Ns: [exec pmap [pid] | grep total]"
- emiliano@maq035:~$ cat withmanyns.tcl
- for { set i 1 } { $i <= 100000 } { incr i } {
- namespace eval foo_$i {}
- set foo_${i}::var [string repeat A 1000]
- }
- puts "One NS per var: [exec pmap [pid] | grep total]"
- emiliano@maq035:~$ tclsh8.5 withdict.tcl ; tclsh8.5 withonens.tcl ; tclsh8.5 withmanyns.tcl
- Dict: total 125644K
- Ns: total 125644K
- One NS per var: total 158412K