]> gitweb.factorcode.org Git - factor.git/blobdiff - extra/benchmark/benchmark.factor
factor: trim using lists
[factor.git] / extra / benchmark / benchmark.factor
index 4735e86647ad3e897f83bbeac08f131998c79390..7ea83e1eba86b7bf758cd624bd1cc92e8b40f3c2 100644 (file)
@@ -1,11 +1,13 @@
 ! Copyright (C) 2007, 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: arrays assocs continuations debugger formatting fry help.markup
-io io.styles kernel math memory namespaces prettyprint sequences
-splitting tools.profiler.sampling tools.test tools.time
-vocabs.hierarchy vocabs.loader ;
+USING: arrays assocs command-line continuations debugger
+formatting help.markup io io.styles kernel math memory
+namespaces sequences tools.profiler.sampling tools.test
+tools.time vocabs.hierarchy vocabs.loader ;
 IN: benchmark
 
+SYMBOL: benchmarks-disabled?
+
 : run-timing-benchmark ( vocab -- time )
     5 swap '[ gc [ _ run ] benchmark ] replicate infimum ;
 
@@ -16,7 +18,12 @@ IN: benchmark
     "benchmark" disk-child-vocab-names [ find-vocab-root ] filter ;
 
 : find-benchmark-vocabs ( -- seq )
-    "benchmarks" get " " split harvest [ all-benchmark-vocabs ] when-empty ;
+    benchmarks-disabled? get [
+        "benchmarks-disabled? is true, not benchmarking anything!" print
+        { }
+    ] [
+        command-line get [ all-benchmark-vocabs ] when-empty
+    ] if ;
 
 <PRIVATE
 
@@ -49,7 +56,7 @@ PRIVATE>
         [
             [
                 [ [ 1array $vocab-link ] with-cell ]
-                [ 1,000,000,000 /f pprint-cell ]
+                [ 1,000,000,000 /f [ "%.3f" printf ] with-cell ]
                 bi*
             ] with-row
         ] assoc-each