Rename benchmark.compiler to optimizer.report

db4
Slava Pestov 2008-02-15 18:04:47 -06:00
parent 51a589835e
commit da716ed6ec
2 changed files with 28 additions and 17 deletions

View File

@ -1,17 +0,0 @@
IN: benchmark.compiler
USING: assocs words sequences arrays compiler tools.time
io.styles io prettyprint vocabs kernel sorting generator
optimizer ;
: recompile-with-timings
all-words [ compiled? ] subset
[ dup [ word-dataflow optimize nip drop ] benchmark nip ] { } map>assoc
sort-values 20 tail*
"Worst offenders:" print
standard-table-style
[
[ [ "Word" write ] with-cell [ "Compile time (ms)" write ] with-cell ] with-row
[ [ [ pprint-cell ] each ] with-row ] each
] tabular-output ;
MAIN: recompile-with-timings

View File

@ -0,0 +1,28 @@
IN: optimizer.report
USING: assocs words sequences arrays compiler tools.time
io.styles io prettyprint vocabs kernel sorting generator
optimizer ;
: count-optimization-passes ( nodes n -- n )
>r optimize-1
[ r> 1+ count-optimization-passes ] [ drop r> ] if ;
: word-table
[ [ second ] swap compose compare ] curry sort 20 tail*
print
standard-table-style
[
[ [ [ pprint-cell ] each ] with-row ] each
] tabular-output ;
: optimizer-report
all-words [ compiled? ] subset
[
dup [
word-dataflow nip 1 count-optimization-passes
] benchmark nip 2array
] { } map>assoc
[ first ] "Worst number of optimizer passes:" results
[ second ] "Worst compile times:" results ;
MAIN: optimizer-report