! 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 ;
"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
[
[
[ [ 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