Tcl/Tk Benchmark Suite And Tools
Check-in [4b57fe927d]
Not logged in
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2018 Conference, Houston/TX, US, Oct 15-19
Send your abstracts to tclconference@googlegroups.com
or submit via the online form by Aug 20.

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment: * tcl/expr.bench (expr-abs): abs proc vs built-in comparison
Timelines: family | ancestors | trunk
Files: files | file ages | folders
SHA1:4b57fe927d52e3b37a4eb0fc84566570e62bdabb
User & Date: hobbs 2011-02-16 19:08:55
Context
2011-02-16
19:08
* tcl/expr.bench (expr-abs): abs proc vs built-in comparison Leaf check-in: 4b57fe927d user: hobbs tags: trunk
19:07
* runbench.tcl (collectData): correct autoscale magic if not repeating and autoscale is requested (ensure output). check-in: 779f7fd6f9 user: hobbs tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ChangeLog.

1
2
3
4


5
6
7
8
9
10
11
2011-02-16  Jeff Hobbs  <jeffh@ActiveState.com>

	* runbench.tcl (collectData): correct autoscale magic if not
	repeating and autoscale is requested (ensure output).



2011-01-19  Jeff Hobbs  <jeffh@ActiveState.com>

	* tcl/format.bench (new): bench for 'format'

	* runbench.tcl (parseOpts): fix scoping and -paths arg handling





>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
2011-02-16  Jeff Hobbs  <jeffh@ActiveState.com>

	* runbench.tcl (collectData): correct autoscale magic if not
	repeating and autoscale is requested (ensure output).

	* tcl/expr.bench (expr-abs): abs proc vs built-in comparison

2011-01-19  Jeff Hobbs  <jeffh@ActiveState.com>

	* tcl/format.bench (new): bench for 'format'

	* runbench.tcl (parseOpts): fix scoping and -paths arg handling

Changes to tcl/expr.bench.

86
87
88
89
90
91
92










93
94
95
96
97
98
99
...
136
137
138
139
140
141
142



143
144
145
146
147
148
149
150
151
152
153
154
}
proc expr-USoD3 {} {
    # 8.5 slowdown caused by UpdateStringOfDouble: http://tip.tcl.tk/132
    # 8.6 performance patched 2010-11-28, 8.5 2010-11-30
    set moo [expr {double(0.000123)}]
    set cow "moo $moo"
}












if { [catch {string repeat "abc" 10}] } {
    proc str-repeat {str num} {
	set val {}
	for {set i 0} {$i < $num} {incr i} { append val $str }
	return $val
................................................................................
bench -body {expr-dbl 100} -desc "EXPR cast double"
if {$tcl_version >= 8.0} {
    bench -body {expr-rand 100} -desc "EXPR rand range"
}
bench -body {expr-rand-fun 100} -desc "EXPR rand range func"
bench -body {expr-builtin} -desc "EXPR builtin sin"
bench -body {expr-builtin-dyn cos 0.5} -desc "EXPR builtin dyn"




foreach val {0 12 17} {
    if {![catch {set tcl_precision $val}]} {
	bench -body { expr-UpdateStringOfDouble } \
	    -desc "EXPR UpdStrOfDbl+1.23 prec$tcl_precision"
	bench -body { expr-USoD2 } \
	    -desc "EXPR UpdStrOfDbl+1e27 prec$tcl_precision"
	bench -body { expr-USoD3 } \
	    -desc "EXPR UpdStrOfDbl+1e-4 prec$tcl_precision"
	unset tcl_precision
    }
}







>
>
>
>
>
>
>
>
>
>







 







>
>
>












86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
...
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
}
proc expr-USoD3 {} {
    # 8.5 slowdown caused by UpdateStringOfDouble: http://tip.tcl.tk/132
    # 8.6 performance patched 2010-11-28, 8.5 2010-11-30
    set moo [expr {double(0.000123)}]
    set cow "moo $moo"
}
proc expr-abs-expr {a b} {
    if {$a > $b} {
	return [expr {$a - $b}]
    } else {
	return [expr {$b - $a}]
    }
}
proc expr-abs-func {a b} {
    return [expr {abs($a - $b)}]
}


if { [catch {string repeat "abc" 10}] } {
    proc str-repeat {str num} {
	set val {}
	for {set i 0} {$i < $num} {incr i} { append val $str }
	return $val
................................................................................
bench -body {expr-dbl 100} -desc "EXPR cast double"
if {$tcl_version >= 8.0} {
    bench -body {expr-rand 100} -desc "EXPR rand range"
}
bench -body {expr-rand-fun 100} -desc "EXPR rand range func"
bench -body {expr-builtin} -desc "EXPR builtin sin"
bench -body {expr-builtin-dyn cos 0.5} -desc "EXPR builtin dyn"

bench -body {expr-abs-expr 0.2 1.5} -desc "EXPR abs as expr"
bench -body {expr-abs-func 0.2 1.5} -desc "EXPR abs builtin"

foreach val {0 12 17} {
    if {![catch {set tcl_precision $val}]} {
	bench -body { expr-UpdateStringOfDouble } \
	    -desc "EXPR UpdStrOfDbl+1.23 prec$tcl_precision"
	bench -body { expr-USoD2 } \
	    -desc "EXPR UpdStrOfDbl+1e27 prec$tcl_precision"
	bench -body { expr-USoD3 } \
	    -desc "EXPR UpdStrOfDbl+1e-4 prec$tcl_precision"
	unset tcl_precision
    }
}