mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Python] Fix 80-column violations
This commit is contained in:
@@ -16,7 +16,8 @@
|
||||
# e.g.
|
||||
# repeat.sh 3 tot/bin/Benchmark_Driver run -o -O > tot.O.times
|
||||
# repeat.sh 3 mypatch/bin/Benchmark_Driver run -o -O > mypatch.O.times
|
||||
# compare_perf_tests.py tot.O.times mypatch.O.times | sort -t, -n -k 6 | column -s, -t
|
||||
# compare_perf_tests.py tot.O.times mypatch.O.times | sort -t, -n -k 6 | \
|
||||
# column -s, -t
|
||||
|
||||
from __future__ import print_function
|
||||
import re
|
||||
@@ -26,8 +27,10 @@ import sys
|
||||
VERBOSE = 0
|
||||
|
||||
# #,TEST,SAMPLES,MIN(ms),MAX(ms),MEAN(ms),SD(ms),MEDIAN(ms)
|
||||
SCORERE = re.compile(r"(\d+),[ \t]*(\w+),[ \t]*([\d.]+),[ \t]*([\d.]+),[ \t]*([\d.]+)")
|
||||
TOTALRE = re.compile(r"()(Totals),[ \t]*([\d.]+),[ \t]*([\d.]+),[ \t]*([\d.]+)")
|
||||
SCORERE = re.compile(
|
||||
r"(\d+),[ \t]*(\w+),[ \t]*([\d.]+),[ \t]*([\d.]+),[ \t]*([\d.]+)")
|
||||
TOTALRE = re.compile(
|
||||
r"()(Totals),[ \t]*([\d.]+),[ \t]*([\d.]+),[ \t]*([\d.]+)")
|
||||
NUMGROUP = 1
|
||||
KEYGROUP = 2
|
||||
BESTGROUP = 4
|
||||
@@ -70,7 +73,8 @@ def get_scores(fname):
|
||||
scores[m.group(KEYGROUP)] = []
|
||||
worstscores[m.group(KEYGROUP)] = []
|
||||
scores[m.group(KEYGROUP)].append(parse_int(m.group(BESTGROUP)))
|
||||
worstscores[m.group(KEYGROUP)].append(parse_int(m.group(WORSTGROUP)))
|
||||
worstscores[m.group(KEYGROUP)].append(
|
||||
parse_int(m.group(WORSTGROUP)))
|
||||
if is_total:
|
||||
nums[m.group(KEYGROUP)] = ""
|
||||
else:
|
||||
@@ -83,7 +87,8 @@ def get_scores(fname):
|
||||
|
||||
|
||||
def is_max_score(newscore, maxscore, invert):
|
||||
return not maxscore or (newscore > maxscore if not invert else newscore < maxscore)
|
||||
return not maxscore or \
|
||||
(newscore > maxscore if not invert else newscore < maxscore)
|
||||
|
||||
|
||||
def compare_scores(key, score1, worstsample1, score2, worstsample2, runs, num):
|
||||
@@ -129,7 +134,8 @@ def compare_scores(key, score1, worstsample1, score2, worstsample2, runs, num):
|
||||
print (("%+d" % (bestscore2 - bestscore1)).rjust(9), end="")
|
||||
|
||||
if bestscore1 != 0 and bestscore2 != 0:
|
||||
print (("%+.1f%%" % (((float(bestscore2) / bestscore1) - 1) * 100)).rjust(9), end="")
|
||||
print (("%+.1f%%" %
|
||||
(((float(bestscore2) / bestscore1) - 1) * 100)).rjust(9), end="")
|
||||
if ShowSpeedup:
|
||||
Num, Den = float(bestscore2), float(bestscore1)
|
||||
if IsTime:
|
||||
@@ -221,4 +227,5 @@ if __name__ == '__main__':
|
||||
if key not in scores2:
|
||||
print(key, "not in", file2)
|
||||
continue
|
||||
compare_scores(key, scores1[key], worstscores1[key], scores2[key], worstscores2[key], runs, nums[key])
|
||||
compare_scores(key, scores1[key], worstscores1[key], scores2[key],
|
||||
worstscores2[key], runs, nums[key])
|
||||
|
||||
Reference in New Issue
Block a user