aotto1968
2024-12-31 10:19:34 UTC
Reply
Permalinkproc test-1 { val } {
if {[regexp ^:: $val]} {
return true
} else {
return false
}
}
proc test-2 { val } {
if {[string range $val 0 1] eq "::"} {
return true
} else {
return false
}
}
set num 100000
puts 1=[time {test-1 ::otto} $num]
puts 2=[time {test-1 otto} $num]
puts 3=[time {test-2 ::otto} $num]
puts 4=[time {test-2 otto} $num]
./sbin/time-check.tcl
1=1.26311 microseconds per iteration2=1.09152 microseconds per iteration
3=1.44028 microseconds per iteration
4=1.43917 microseconds per iteration