OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 | 2 |
3 import sys | 3 import sys |
4 from scipy.stats import mannwhitneyu | 4 from scipy.stats import mannwhitneyu |
5 | 5 |
6 SIGNIFICANCE_THRESHOLD = 0.0001 | 6 SIGNIFICANCE_THRESHOLD = 0.0001 |
7 | 7 |
8 a,b = {},{} | 8 a,b = {},{} |
9 for (path, d) in [(sys.argv[1], a), (sys.argv[2], b)]: | 9 for (path, d) in [(sys.argv[1], a), (sys.argv[2], b)]: |
10 for line in open(path): | 10 for line in open(path): |
(...skipping 18 matching lines...) Expand all Loading... |
29 for threshold, suffix in [(1e9, 's'), (1e6, 'ms'), (1e3, 'us'), (1e0, 'ns')]
: | 29 for threshold, suffix in [(1e9, 's'), (1e6, 'ms'), (1e3, 'us'), (1e0, 'ns')]
: |
30 if ns > threshold: | 30 if ns > threshold: |
31 return "%.3g%s" % (ns/threshold, suffix) | 31 return "%.3g%s" % (ns/threshold, suffix) |
32 | 32 |
33 maxlen = max(map(len, common)) | 33 maxlen = max(map(len, common)) |
34 | 34 |
35 # We print only signficant changes in benchmark timing distribution. | 35 # We print only signficant changes in benchmark timing distribution. |
36 bonferroni = SIGNIFICANCE_THRESHOLD / len(ps) # Adjust for the fact we've run m
ultiple tests. | 36 bonferroni = SIGNIFICANCE_THRESHOLD / len(ps) # Adjust for the fact we've run m
ultiple tests. |
37 for ratio, p, key, am, bm in ps: | 37 for ratio, p, key, am, bm in ps: |
38 if p < bonferroni: | 38 if p < bonferroni: |
39 print '%*s\t%6s -> %6s\t%.2gx' % (maxlen, key, humanize(am), humanize(bm
), ratio) | 39 str_ratio = ('%.2gx' if ratio < 1 else '%.3gx') % ratio |
| 40 print '%*s\t%6s -> %6s\t%s' % (maxlen, key, humanize(am), humanize(bm),
str_ratio) |
OLD | NEW |