Skip to content

Commit

Permalink
adds binary check
Browse files Browse the repository at this point in the history
  • Loading branch information
cheqianh committed Mar 28, 2023
1 parent f253ac5 commit 14785d3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions amazon/ionbenchmark/ion_benchmark_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ def write_micro_benchmark_simpleion(iterations, warmups, c_extension, file, bina
# Benchmarks JSON/CBOR dump/dumps APIs
def write_micro_benchmark(iterations, warmups, c_extension, file, binary, memory_profiling, format_option, io_type):
file_size = Path(file).stat().st_size / BYTES_TO_MB
obj = generate_json_and_cbor_obj_for_write(file, format_option)
obj = generate_json_and_cbor_obj_for_write(file, format_option, binary=binary)
# GC refers to reference cycles, not reference count
setup_with_gc = generate_setup(format_option=format_option, gc=False, memory_profiling=memory_profiling)

Expand Down Expand Up @@ -555,8 +555,8 @@ def reset_for_each_execution(each_option):
return api, format_option, io_type


def generate_json_and_cbor_obj_for_write(file, format_option):
with open(file) as fp:
def generate_json_and_cbor_obj_for_write(file, format_option, binary):
with open(file, 'br' if binary else 'r') as fp:
if format_option == Format.JSON.value:
return json.load(fp)
elif format_option == Format.SIMPLEJSON.value:
Expand Down

0 comments on commit 14785d3

Please sign in to comment.