Posted to tcl by mjanssen at Mon Oct 22 19:23:53 GMT 2007view raw
- # static non-threaded build: ./configure --disable-shared --disable-threads --disable-symbols CFLAGS="-march=i686"
- mjanssen@juno:~/test$ tclsh8.5 test.tcl test.dat > /dev/null
- 15882535
- 16545939
- 15709562
- 15764823
- 16055450
- 16917391
- 15800930
- 16009375
- 16300071
- 16056347
- mean: 16104242.3
- sdev: 383037.6532669109
- # shared, threaded build: ./configure
- mjanssen@juno:~/test$ tclsh8.5 test.tcl test.dat > /dev/null
- 50255500
- 48259472
- 46758870
- 44438737
- 45814076
- 45172940
- 44581582
- 46459528
- 44839097
- 44579642
- mean: 46115944.4
- sdev: 1897374.5886940137
- # script
- fconfigure stdout -buffering full
- proc my_grep {re file} {
- set f [open $file r]
- fconfigure $f -encoding ascii -translation lf
- while {[gets $f buf] >= 0} {
- if {[regexp -- $re $buf]} {puts $buf}
- }
- close $f
- }
- set re {^$}
- fconfigure stdout -encoding binary -translation binary
- foreach file $argv {
- foreach i {0 1 2 3 4 5 6 7 8 9} {
- lappend res [lindex [time {my_grep $re $file} 1] 0]
- puts stderr [lindex $res end]
- }
- }
- puts stderr "mean: [::math::statistics::mean $res]"
- puts stderr "sdev: [::math::statistics::stdev $res]"