1 ! Copyright (C) 2007, 2009 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 namespaces ;
15 : run-benchmark ( vocab -- )
16 [ "=== " write vocab-name print flush ] [
17 [ [ require ] [ [ run ] benchmark ] [ ] tri timings ]
22 : run-benchmarks ( -- timings errors )
24 V{ } clone timings set
26 "benchmark" all-child-vocabs-seq
27 [ run-benchmark ] each
32 : timings. ( assocs -- )
33 standard-table-style [
35 [ "Benchmark" write ] with-cell
36 [ "Time (seconds)" write ] with-cell
40 [ [ 1array $vocab-link ] with-cell ]
41 [ 1000000 /f pprint-cell ]
47 : benchmark-errors. ( errors -- )
49 [ "=== " write vocab-name print ]
55 run-benchmarks [ timings. ] [ benchmark-errors. ] bi* ;