factor/extra/benchmark/benchmark.factor

35 lines
899 B
Factor
Raw Normal View History

2008-02-12 16:51:34 -05:00
! Copyright (C) 2007, 2008 Slava Pestov.
2007-09-20 18:09:08 -04:00
! See http://factorcode.org/license.txt for BSD license.
USING: kernel vocabs vocabs.loader tools.time tools.vocabs
2008-02-12 16:51:34 -05:00
arrays assocs io.styles io help.markup prettyprint sequences
2008-03-29 00:00:20 -04:00
continuations debugger ;
2007-09-20 18:09:08 -04:00
IN: benchmark
: run-benchmark ( vocab -- result )
2008-05-07 18:42:41 -04:00
[ [ require ] [ [ run ] benchmark ] bi ] curry
2008-03-13 04:35:54 -04:00
[ error. f ] recover ;
2007-09-20 18:09:08 -04:00
: run-benchmarks ( -- assoc )
2008-03-13 04:35:54 -04:00
"benchmark" all-child-vocabs-seq
2008-02-17 09:01:43 -05:00
[ dup run-benchmark ] { } map>assoc ;
2007-09-20 18:09:08 -04:00
: benchmarks. ( assoc -- )
standard-table-style [
[
[ "Benchmark" write ] with-cell
2008-03-13 04:35:54 -04:00
[ "Time (ms)" write ] with-cell
2007-09-20 18:09:08 -04:00
] with-row
[
[
2008-03-13 04:35:54 -04:00
[ [ 1array $vocab-link ] with-cell ]
[ pprint-cell ] bi*
2007-09-20 18:09:08 -04:00
] with-row
] assoc-each
] tabular-output ;
: benchmarks ( -- )
run-benchmarks benchmarks. ;
MAIN: benchmarks