factor/extra/builder/benchmark/benchmark.factor

43 lines
1.1 KiB
Factor
Raw Normal View History

2008-02-19 07:08:42 -05:00
USING: kernel continuations arrays assocs sequences sorting math
io io.styles prettyprint builder.util ;
IN: builder.benchmark
2008-03-16 17:57:22 -04:00
! : passing-benchmarks ( table -- table )
! [ second first2 number? swap number? and ] subset ;
2008-02-19 07:08:42 -05:00
2008-03-16 17:57:22 -04:00
: passing-benchmarks ( table -- table ) [ second number? ] subset ;
! : simplify-table ( table -- table ) [ first2 second 2array ] map ;
2008-02-19 07:08:42 -05:00
: benchmark-difference ( old-table benchmark-result -- result-diff )
first2 >r
tuck swap at
r>
swap -
2array ;
: compare-tables ( old new -- table )
2008-03-29 21:36:58 -04:00
[ passing-benchmarks ] bi@
2008-02-19 07:08:42 -05:00
[ benchmark-difference ] with map ;
: benchmark-deltas ( -- table )
2008-03-29 21:36:58 -04:00
"../benchmarks" "benchmarks" [ eval-file ] bi@
2008-02-19 07:08:42 -05:00
compare-tables
sort-values ;
: benchmark-deltas. ( deltas -- )
standard-table-style
[
[ [ "Benchmark" write ] with-cell [ "Delta (ms)" write ] with-cell ]
with-row
[ [ swap [ write ] with-cell pprint-cell ] with-row ]
assoc-each
]
tabular-output ;
: show-benchmark-deltas ( -- )
[ benchmark-deltas benchmark-deltas. ]
[ drop "Error generating benchmark deltas" . ]
recover ;