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

Side by Side Diff: bin/compare

Issue 1420963010: compare has a syntax error where it is missing the path to sem(). (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 1 month 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 | « no previous file | 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 argparse 3 import argparse
4 import sys 4 import sys
5 5
6 have_scipy = True 6 have_scipy = True
7 try: 7 try:
8 import scipy.stats 8 import scipy.stats
9 except: 9 except:
10 have_scipy = False 10 have_scipy = False
(...skipping 27 matching lines...) Expand all
38 def mean(xs): 38 def mean(xs):
39 return sum(xs) / len(xs) 39 return sum(xs) / len(xs)
40 40
41 ps = [] 41 ps = []
42 for key in common: 42 for key in common:
43 p, asem, bsem = 0, 0, 0 43 p, asem, bsem = 0, 0, 0
44 m = mean if args.use_means else min 44 m = mean if args.use_means else min
45 am, bm = m(a[key]), m(b[key]) 45 am, bm = m(a[key]), m(b[key])
46 if have_scipy: 46 if have_scipy:
47 _, p = scipy.stats.mannwhitneyu(a[key], b[key]) 47 _, p = scipy.stats.mannwhitneyu(a[key], b[key])
48 asem, bsem = scipy.stats.sem(a[key]), sem(b[key]) 48 asem, bsem = scipy.stats.sem(a[key]), scipy.stats.sem(b[key])
49 ps.append((bm/am, p, key, am, bm, asem, bsem)) 49 ps.append((bm/am, p, key, am, bm, asem, bsem))
50 ps.sort(reverse=True) 50 ps.sort(reverse=True)
51 51
52 def humanize(ns): 52 def humanize(ns):
53 for threshold, suffix in [(1e9, 's'), (1e6, 'ms'), (1e3, 'us'), (1e0, 'ns')] : 53 for threshold, suffix in [(1e9, 's'), (1e6, 'ms'), (1e3, 'us'), (1e0, 'ns')] :
54 if ns > threshold: 54 if ns > threshold:
55 return "%.3g%s" % (ns/threshold, suffix) 55 return "%.3g%s" % (ns/threshold, suffix)
56 56
57 maxlen = max(map(len, common)) 57 maxlen = max(map(len, common))
58 58
59 # We print only signficant changes in benchmark timing distribution. 59 # We print only signficant changes in benchmark timing distribution.
60 bonferroni = SIGNIFICANCE_THRESHOLD / len(ps) # Adjust for the fact we've run m ultiple tests. 60 bonferroni = SIGNIFICANCE_THRESHOLD / len(ps) # Adjust for the fact we've run m ultiple tests.
61 for ratio, p, key, am, bm, asem, bsem in ps: 61 for ratio, p, key, am, bm, asem, bsem in ps:
62 if p < bonferroni: 62 if p < bonferroni:
63 str_ratio = ('%.2gx' if ratio < 1 else '%.3gx') % ratio 63 str_ratio = ('%.2gx' if ratio < 1 else '%.3gx') % ratio
64 if args.use_means: 64 if args.use_means:
65 print '%*s\t%6s(%6s) -> %6s(%6s)\t%s' % (maxlen, key, humanize(am), humanize(asem), 65 print '%*s\t%6s(%6s) -> %6s(%6s)\t%s' % (maxlen, key, humanize(am), humanize(asem),
66 humanize(bm), humanize(bsem ), str_ratio) 66 humanize(bm), humanize(bsem ), str_ratio)
67 else: 67 else:
68 print '%*s\t%6s -> %6s\t%s' % (maxlen, key, humanize(am), humanize(b m), str_ratio) 68 print '%*s\t%6s -> %6s\t%s' % (maxlen, key, humanize(am), humanize(b m), str_ratio)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698