ac729cbd2f
--HG-- rename : cmd/main.go => cmd/markdown/main.go
71 lines
1010 B
Bash
71 lines
1010 B
Bash
#!/usr/local/plan9/bin/rc
|
|
|
|
nrun=20
|
|
md=./cmd/markdown/markdown
|
|
|
|
fn timego{
|
|
run $md go
|
|
}
|
|
fn timegoprev{
|
|
run ./,,prevmd/src/github.com/knieriem/markdown/$md goprev
|
|
}
|
|
|
|
fn timec{
|
|
run ,,pmd/markdown c
|
|
}
|
|
|
|
fn run{
|
|
xtime $1 < m >[2=1] > /tmp/,,out.$2
|
|
}
|
|
|
|
fn xtime{
|
|
# /usr/bin/time -f '%Uu %Ss %er %MkB %C' $*
|
|
/usr/bin/time -f '%U %M' $*
|
|
}
|
|
|
|
fn cmpout{
|
|
if (! cmp /tmp/,,out.$1 /tmp/,,out.$2) {
|
|
echo not equal: $1 $2 >[1=2]
|
|
exit -1
|
|
}
|
|
}
|
|
|
|
{
|
|
start = 1
|
|
for (i in `{seq 1 $nrun}) {
|
|
echo `{timec} `{timego} `{timegoprev}
|
|
if (~ $start 1){
|
|
cmpout go c
|
|
cmpout go goprev
|
|
start = 0
|
|
}
|
|
}
|
|
} | awk '
|
|
BEGIN {
|
|
pfx = "#"
|
|
}
|
|
{
|
|
tc = $1
|
|
mc = $2
|
|
tgo = $3
|
|
mgo = $4
|
|
tprev = $5
|
|
mprev = 46
|
|
}
|
|
{
|
|
print pfx, "c:", tc, "go:" tgo, "frac:", tgo/tc, "go,prev:", tgo/tprev*100, " %", "mem:", mgo/mc
|
|
}
|
|
NR < 5 { next }
|
|
{
|
|
pfx = ""
|
|
csum += tc
|
|
gosum += tgo
|
|
goprevsum += tprev
|
|
n++
|
|
}
|
|
END {
|
|
print "SUM"
|
|
print "c:", csum, "go:", gosum, "n:", n, "frac", gosum/csum, gosum/goprevsum*100, " %"
|
|
}
|
|
'
|