1 ! Copyright (C) 2007, 2008 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: kernel vocabs vocabs.loader tools.time tools.vocabs
4 arrays assocs io.styles io help.markup prettyprint sequences
5 continuations debugger math ;
8 : run-benchmark ( vocab -- result )
9 [ "=== " write vocab-name print flush ] [
10 [ [ require ] [ [ run ] benchmark ] bi ] curry
14 : run-benchmarks ( -- assoc )
15 "benchmark" all-child-vocabs-seq
16 [ dup run-benchmark ] { } map>assoc ;
18 : benchmarks. ( assoc -- )
19 standard-table-style [
21 [ "Benchmark" write ] with-cell
22 [ "Time (seconds)" write ] with-cell
26 [ [ 1array $vocab-link ] with-cell ]
27 [ [ 1000000 /f pprint-cell ] [ "failed" write ] if* ] bi*
33 run-benchmarks benchmarks. ;