summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2015-10-25 10:57:26 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2015-10-25 10:57:26 (GMT)
commite1b162e92dca41682e812418307abf40d181084c (patch)
tree982dbe827973bb88ff458cb31900fedca770c914
parent66718c29e87bb9d9a3e521373c60d5c812c04736 (diff)
downloadtcl-e1b162e92dca41682e812418307abf40d181084c.zip
tcl-e1b162e92dca41682e812418307abf40d181084c.tar.gz
tcl-e1b162e92dca41682e812418307abf40d181084c.tar.bz2
Allow tuning of the number of iterations in the micro-opt loops.
-rw-r--r--tools/microoptimization/clockformatscan.tcl6
-rw-r--r--tools/microoptimization/generalbytecode.tcl13
2 files changed, 9 insertions, 10 deletions
diff --git a/tools/microoptimization/clockformatscan.tcl b/tools/microoptimization/clockformatscan.tcl
index 844562e..c7cec46 100644
--- a/tools/microoptimization/clockformatscan.tcl
+++ b/tools/microoptimization/clockformatscan.tcl
@@ -1,5 +1,5 @@
-apply {{} {
- for {set i 0} {$i < 5000} {incr i} {
+apply {{{limit 5000}} {
+ for {set i 0} {$i < $limit} {incr i} {
clock scan [clock format $i -format %T] -format %T
}
-}}
+}} {*}$argv
diff --git a/tools/microoptimization/generalbytecode.tcl b/tools/microoptimization/generalbytecode.tcl
index 9c0a545..2471943 100644
--- a/tools/microoptimization/generalbytecode.tcl
+++ b/tools/microoptimization/generalbytecode.tcl
@@ -1,14 +1,13 @@
-apply {{} {
- for {set i 0} {$i < 100} {incr i} {
- apply {{} {
+apply {{{limit1 100} {limit2 1000}} {
+ for {set i 0} {$i < $limit1} {incr i} {
+ apply {limit2 {
set a {}
set b {}
- for {set i 0} {$i < 1000} {incr i} {
+ for {set i 0} {$i < $limit2} {incr i} {
lappend a $i
dict set b $i [expr {$i*$i}]
}
return [string length $a],[string length $b]
- }}
+ }} $limit2
}
-}}
-
+}} {*}$argv