aboutsummaryrefslogtreecommitdiff
path: root/bench.tcl
diff options
context:
space:
mode:
authorpatthoyts <patthoyts>2005-03-08 13:45:20 +0000
committerpatthoyts <patthoyts>2005-03-08 13:45:20 +0000
commit13e52adb1dea991b724c50d4e2019eda1f517cd5 (patch)
tree7c3effaecbdea990dfd9ff7696678a975434c5cd /bench.tcl
parentd5990c487e0cb9edbf973ff1a58ea45a1c767e1e (diff)
downloadjimtcl-13e52adb1dea991b724c50d4e2019eda1f517cd5.zip
jimtcl-13e52adb1dea991b724c50d4e2019eda1f517cd5.tar.gz
jimtcl-13e52adb1dea991b724c50d4e2019eda1f517cd5.tar.bz2
Added [info patchlevel] and setup argv0 and argv variables in jimsh.
Changed Jim_InteractivePrompt to take a pre-initialized interpreter.
Diffstat (limited to 'bench.tcl')
-rw-r--r--bench.tcl27
1 files changed, 22 insertions, 5 deletions
diff --git a/bench.tcl b/bench.tcl
index 202c69f..b0f6457 100644
--- a/bench.tcl
+++ b/bench.tcl
@@ -1,9 +1,18 @@
+set batchmode 0
+set benchmarks {}
+
proc bench {title script} {
- while {[string length $title] < 20} {
- append title " "
- }
- if {[catch {puts "$title - [time $script]"}]} {
- puts "$title - This test can't run on this interpreter"
+ global benchmarks batchmode
+
+ set Title [string range "$title [string repeat " " 20]" 0 20]
+
+ set failed [catch {time $script} res]
+ if {$failed} {
+ if {!$batchmode} {puts "$Title - This test can't run on this interpreter"}
+ lappend benchmarks $title F
+ } else {
+ if {!$batchmode} {puts "$Title - $res"}
+ lappend benchmarks $title [lindex $res 0]
}
}
@@ -271,6 +280,10 @@ proc miniloops {} {
### RUN ALL ####################################################################
+if {[string compare [lindex $argv 0] "-batch"] == 0} {
+ set batchmode 1
+}
+
bench {[while] busy loop} {whilebusyloop}
bench {[for] busy loop} {forbusyloop}
bench {mini loops} {miniloops}
@@ -286,3 +299,7 @@ bench {dynamic code} {dyncode}
bench {dynamic code (list)} {dyncode_list}
bench {PI digits} {pi_digits}
bench {expand} {expand}
+
+if {$batchmode} {
+ puts [list [info patchlevel] $benchmarks]
+} \ No newline at end of file