35
35
def main ():
36
36
parser = argparse .ArgumentParser ()
37
37
parser .add_argument ('--pure' , action = 'store_true' )
38
- parser .add_argument ('-n' , '--num-iterations' , default = DEFAULT_ITERATIONS ,
39
- type = int )
38
+ parser .add_argument (
39
+ '-n' , '--num-iterations' , default = DEFAULT_ITERATIONS , type = int
40
+ )
40
41
parser .add_argument ('benchmarks' , nargs = '*' )
41
42
args = parser .parse_args ()
42
43
if not args .benchmarks :
@@ -47,7 +48,6 @@ def main():
47
48
with open (f , encoding = 'utf-8' ) as fp :
48
49
file_contents .append (fp .read ())
49
50
50
-
51
51
# json.decoder.c_scanstring = py_scanstring
52
52
def py_maker (* args , ** kwargs ):
53
53
del args
@@ -81,20 +81,28 @@ def py_maker(*args, **kwargs):
81
81
if json5_time and json_time :
82
82
if json5_time > json_time :
83
83
avg = json5_time / json_time
84
- print (f"{ fname :-%20s} : JSON was { avg :5.1f} x faster "
85
- f"({ json_time :.6f} to { json5_time :.6fs} " )
84
+ print (
85
+ f'{ fname :-%20s} : JSON was { avg :5.1f} x faster '
86
+ f'({ json_time :.6f} to { json5_time :.6fs} '
87
+ )
86
88
else :
87
89
avg = json_time / json5_time
88
- print (f"{ fname :-%20s} : JSON5 was { avg :5.1f} x faster "
89
- f"({ json5_time :.6f} to { json_time :.6fs} " )
90
+ print (
91
+ f'{ fname :-%20s} : JSON5 was { avg :5.1f} x faster '
92
+ f'({ json5_time :.6f} to { json_time :.6fs} '
93
+ )
90
94
elif json5_time :
91
- print (f"{ fname :-20s} : JSON5 took { json5_time :.6f} secs, "
92
- f"JSON was too fast to measure" )
95
+ print (
96
+ f'{ fname :-20s} : JSON5 took { json5_time :.6f} secs, '
97
+ f'JSON was too fast to measure'
98
+ )
93
99
elif json_time :
94
- print (f"{ fname :-20s} : JSON took { json_time :.6f} secs, "
95
- f"JSON5 was too fast to measure" )
100
+ print (
101
+ f'{ fname :-20s} : JSON took { json_time :.6f} secs, '
102
+ f'JSON5 was too fast to measure'
103
+ )
96
104
else :
97
- print (f" { fname :-20s} : both were too fast to measure" )
105
+ print (f' { fname :-20s} : both were too fast to measure' )
98
106
99
107
return 0
100
108
0 commit comments