mirror of
https://github.com/nineties/planckforth
synced 2024-12-26 21:58:42 +01:00
Add the first benchmark
This commit is contained in:
parent
0ded810818
commit
04b2474681
3 changed files with 53 additions and 0 deletions
18
.github/workflows/benchmark.yaml
vendored
Normal file
18
.github/workflows/benchmark.yaml
vendored
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
name: benchmark
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v1
|
||||||
|
- name: take benchmarks
|
||||||
|
run: |
|
||||||
|
./benchmark/gendoc.sh
|
||||||
|
- name: upload to wiki
|
||||||
|
uses: SwiftDocOrg/github-wiki-publish-action@v1
|
||||||
|
with:
|
||||||
|
path: "documentation"
|
||||||
|
env:
|
||||||
|
GH_PERSONAL_ACCESS_TOKEN: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
|
35
benchmark/gendoc.sh
Executable file
35
benchmark/gendoc.sh
Executable file
|
@ -0,0 +1,35 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
mkdir -p document
|
||||||
|
|
||||||
|
FILE=document/benchmark.md
|
||||||
|
TARGETS="i386-linux-handwritten c python"
|
||||||
|
TIMEFORMAT='%U'
|
||||||
|
function benchmark () {
|
||||||
|
sum=0
|
||||||
|
for i in `seq $2`; do
|
||||||
|
t=`{ eval $1; } 2>&1`
|
||||||
|
sum=`echo $t + $sum | bc`
|
||||||
|
done
|
||||||
|
average=`echo "scale=3; $sum / $2" | bc | xargs printf "%.3f"`
|
||||||
|
echo $average
|
||||||
|
}
|
||||||
|
|
||||||
|
function bootstrap {
|
||||||
|
time ./planck < bootstrap.fs benchmark/nop.fs 2>&1 > /dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
function generate-table {
|
||||||
|
echo "## $1"
|
||||||
|
echo
|
||||||
|
echo "| implementation | sec |"
|
||||||
|
echo "|:---------------|----:|"
|
||||||
|
for impl in $TARGETS; do
|
||||||
|
make $impl 2>&1 > /dev/null
|
||||||
|
t=`benchmark $2 $3`
|
||||||
|
echo "| $impl | $t |"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "# Benchmarks" >> $FILE
|
||||||
|
generate-table "Bootstrap Time" bootstrap 5
|
0
benchmark/nop.fs
Normal file
0
benchmark/nop.fs
Normal file
Loading…
Reference in a new issue