Skip to content

Commit 6d4bbb1

Browse files
committed
Support multiple input filenames
There was no reason not to, so let's handle that properly. Signed-off-by: Rodrigo Tobar <[email protected]>
1 parent ca62714 commit 6d4bbb1

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

ijson/benchmark.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ def run_benchmarks(args, benchmark_func=None, fname=None):
147147
size = len(data)
148148
else:
149149
bname = fname
150-
size = os.stat(args.input).st_size
150+
size = os.stat(fname).st_size
151151

152152
# Prepare reader
153153
def get_reader():
@@ -239,7 +239,7 @@ def main():
239239
default=ALL_BACKENDS)
240240
parser.add_argument('-l', '--list', action='store_true',
241241
help='List available benchmarks and backends')
242-
parser.add_argument('input',
242+
parser.add_argument('inputs', nargs='*',
243243
help='File to use for benchmarks rather than built-in benchmarking functions')
244244
parser.add_argument('-M', '--multiple-values', action='store_true', default=False,
245245
help='Content has multiple JSON values, useful when used with -i')
@@ -263,8 +263,9 @@ def main():
263263
return
264264

265265
print("#mbytes, method, test_case, backend, time_min, time_avg, time_median, time_max, mb_per_sec_min, mb_per_sec_avg, mb_per_sec_median, mb_per_sec_max")
266-
if args.input:
267-
run_benchmarks(args, fname=args.input)
266+
if args.inputs:
267+
for filename in args.inputs:
268+
run_benchmarks(args, fname=filename)
268269
else:
269270
for benchmark in args.benchmarks:
270271
run_benchmarks(args, benchmark)

0 commit comments

Comments
 (0)