Skip to content

Commit

Permalink
Support multiple input filenames
Browse files Browse the repository at this point in the history
There was no reason not to, so let's handle that properly.

Signed-off-by: Rodrigo Tobar <rtobar@icrar.org>
  • Loading branch information
rtobar committed Nov 30, 2023
1 parent ca62714 commit 6d4bbb1
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions ijson/benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def run_benchmarks(args, benchmark_func=None, fname=None):
size = len(data)
else:
bname = fname
size = os.stat(args.input).st_size
size = os.stat(fname).st_size

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

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")
if args.input:
run_benchmarks(args, fname=args.input)
if args.inputs:
for filename in args.inputs:
run_benchmarks(args, fname=filename)
else:
for benchmark in args.benchmarks:
run_benchmarks(args, benchmark)
Expand Down

0 comments on commit 6d4bbb1

Please sign in to comment.