2011-07-04 16:25:32 +00:00
|
|
|
#!/usr/local/plan9/bin/rc
|
|
|
|
|
|
|
|
nrun=20
|
2012-04-20 11:35:31 +00:00
|
|
|
md=./cmd/markdown/markdown
|
2011-07-04 16:25:32 +00:00
|
|
|
|
|
|
|
fn timego{
|
2012-04-20 11:35:31 +00:00
|
|
|
run $md go
|
2011-07-04 16:25:32 +00:00
|
|
|
}
|
|
|
|
fn timegoprev{
|
2012-04-20 11:35:31 +00:00
|
|
|
run ./,,prevmd/src/github.com/knieriem/markdown/$md goprev
|
2011-07-04 16:25:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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, " %"
|
|
|
|
}
|
|
|
|
'
|