Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(361)

Side by Side Diff: bin/compare

Issue 1208763003: Don't suppress nanobench output table in verbose mode (Closed) Base URL: https://skia.googlesource.com/skia.git@upload_timesamples
Patch Set: rebase Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « bench/nanobench.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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):
11 try: 11 try:
12 tokens = line.split() 12 tokens = line.split()
13 samples = tokens[:-1] 13 if tokens[0] != "Samples:":
14 label = tokens[-1] 14 continue
15 samples = tokens[1:-1]
16 label = tokens[-1]
15 d[label] = map(float, samples) 17 d[label] = map(float, samples)
16 except: 18 except:
17 pass 19 pass
18 20
19 common = set(a.keys()).intersection(b.keys()) 21 common = set(a.keys()).intersection(b.keys())
20 22
21 ps = [] 23 ps = []
22 for key in common: 24 for key in common:
23 _, p = mannwhitneyu(a[key], b[key]) # Non-parametric t-test. Doesn't ass ume normal dist. 25 _, p = mannwhitneyu(a[key], b[key]) # Non-parametric t-test. Doesn't ass ume normal dist.
24 am, bm = min(a[key]), min(b[key]) 26 am, bm = min(a[key]), min(b[key])
25 ps.append((bm/am, p, key, am, bm)) 27 ps.append((bm/am, p, key, am, bm))
26 ps.sort(reverse=True) 28 ps.sort(reverse=True)
27 29
28 def humanize(ns): 30 def humanize(ns):
29 for threshold, suffix in [(1e9, 's'), (1e6, 'ms'), (1e3, 'us'), (1e0, 'ns')] : 31 for threshold, suffix in [(1e9, 's'), (1e6, 'ms'), (1e3, 'us'), (1e0, 'ns')] :
30 if ns > threshold: 32 if ns > threshold:
31 return "%.3g%s" % (ns/threshold, suffix) 33 return "%.3g%s" % (ns/threshold, suffix)
32 34
33 maxlen = max(map(len, common)) 35 maxlen = max(map(len, common))
34 36
35 # We print only signficant changes in benchmark timing distribution. 37 # 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. 38 bonferroni = SIGNIFICANCE_THRESHOLD / len(ps) # Adjust for the fact we've run m ultiple tests.
37 for ratio, p, key, am, bm in ps: 39 for ratio, p, key, am, bm in ps:
38 if p < bonferroni: 40 if p < bonferroni:
39 str_ratio = ('%.2gx' if ratio < 1 else '%.3gx') % ratio 41 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) 42 print '%*s\t%6s -> %6s\t%s' % (maxlen, key, humanize(am), humanize(bm), str_ratio)
OLDNEW
« no previous file with comments | « bench/nanobench.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698