-
-
Save mtklein/7fe3b12ef0b6c294c387 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -e | |
BRANCH=$(git branch | grep \* | cut -d" " -f 2) | |
CLEAN=${CLEAN-clean} | |
SAMPLES=100 | |
if [ $BRANCH == $CLEAN ]; then | |
echo "Comparing $BRANCH to itself." | |
exit 1 | |
fi | |
git checkout $CLEAN | |
./gyp_skia >/dev/null | |
ninja -C out/Release nanobench | |
out/Release/nanobench $@ --samples $SAMPLES -v 2> $CLEAN.log | |
git checkout $BRANCH | |
./gyp_skia >/dev/null | |
ninja -C out/Release nanobench | |
out/Release/nanobench $@ --samples $SAMPLES -v 2> $BRANCH.log | |
compare $CLEAN.log $BRANCH.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
from scipy.stats import mannwhitneyu | |
THRESHOLD = 0.0001 | |
def median(xs): | |
copy = xs[:] | |
copy.sort() | |
return copy[len(copy)/2] | |
def mean(xs): | |
return sum(xs) / len(xs) | |
display_stat = min | |
a,b = {},{} | |
for (path, d) in [(sys.argv[1], a), (sys.argv[2], b)]: | |
for line in open(path): | |
try: | |
tokens = line.split() | |
samples = tokens[:-1] | |
label = tokens[-1] | |
d[label] = map(float, samples) | |
except: | |
pass | |
common = set(a.keys()).intersection(b.keys()) | |
ps = [] | |
for key in common: | |
_, p = mannwhitneyu(a[key], b[key]) | |
am, bm = display_stat(a[key]), display_stat(b[key]) | |
ps.append((bm/am, p, key, am, bm)) | |
ps.sort(reverse=True) | |
def humanize(ns): | |
for threshold, suffix in [(1e9, 's'), (1e6, 'ms'), (1e3, 'us'), (1e0, 'ns')]: | |
if ns > threshold: | |
return "%.3g%s" % (ns/threshold, suffix) | |
maxlen = max(map(len, common)) | |
bonferroni = THRESHOLD / len(ps) | |
for ratio, p, key, am, bm in ps: | |
if p < bonferroni: | |
print '%*s\t%6s -> %6s\t%.2gx' % (maxlen, key, humanize(am), humanize(bm), ratio) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment