mirror of
https://github.com/nineties/planckforth
synced 2024-12-26 21:58:42 +01:00
Add new benchmark
This commit is contained in:
parent
56b990c297
commit
968e0c2838
2 changed files with 8 additions and 7 deletions
2
benchmark/fib.fs
Normal file
2
benchmark/fib.fs
Normal file
|
@ -0,0 +1,2 @@
|
|||
: fib dup 2 < unless 1- dup recurse swap 1- recurse + then ;
|
||||
20 fib . cr
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
TARGETS="i386-linux-handwritten c"
|
||||
TARGETS="i386-linux-handwritten c python"
|
||||
TIMEFORMAT='%U'
|
||||
function benchmark () {
|
||||
sum=0
|
||||
|
@ -12,21 +12,20 @@ function benchmark () {
|
|||
echo $average
|
||||
}
|
||||
|
||||
function bootstrap {
|
||||
time ./planck < bootstrap.fs benchmark/nop.fs 2>&1 > /dev/null
|
||||
}
|
||||
|
||||
function generate-table {
|
||||
echo "## $1"
|
||||
echo "\`$2\`"
|
||||
echo
|
||||
echo "| implementation | sec |"
|
||||
echo "|:---------------|----:|"
|
||||
for impl in $TARGETS; do
|
||||
make $impl 2>&1 > /dev/null
|
||||
t=`benchmark $2 $3`
|
||||
t=`benchmark "time $2 2>&1 > /dev/null" $3`
|
||||
echo "| $impl | $t |"
|
||||
done
|
||||
echo
|
||||
}
|
||||
|
||||
echo "# Benchmarks"
|
||||
generate-table "Bootstrap Time" bootstrap 5
|
||||
generate-table "Bootstrap Time" "./planck < bootstrap.fs benchmark/nop.fs" 1
|
||||
generate-table "Fib(20)" "./planck < bootstrap.fs benchmark/fib.fs" 1
|
||||
|
|
Loading…
Reference in a new issue