Skip to content
This repository was archived by the owner on Mar 31, 2026. It is now read-only.

Commit 799bc99

Browse files
committed
refactor: simplify throughput calculations and improve function documentation
1 parent ffc7cd1 commit 799bc99

3 files changed

Lines changed: 7 additions & 10 deletions

File tree

tests/perf/microbenchmarks/_utils.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,11 @@ def publish_benchmark_extra_info(
4343

4444
object_size = params.file_size_bytes
4545
num_files = params.num_files
46-
min_throughput = (object_size / (1024 * 1024) * num_files) / benchmark.stats["max"]
47-
max_throughput = (object_size / (1024 * 1024) * num_files) / benchmark.stats["min"]
48-
mean_throughput = (object_size / (1024 * 1024) * num_files) / benchmark.stats["mean"]
49-
median_throughput = (
50-
object_size / (1024 * 1024) * num_files
51-
) / benchmark.stats["median"]
46+
total_uploaded_mib = (object_size / (1024 * 1024) * num_files)
47+
min_throughput = total_uploaded_mib / benchmark.stats["max"]
48+
max_throughput = total_uploaded_mib / benchmark.stats["min"]
49+
mean_throughput = total_uploaded_mib / benchmark.stats["mean"]
50+
median_throughput = total_uploaded_mib / benchmark.stats["median"]
5251

5352
benchmark.extra_info["throughput_MiB_s_min"] = min_throughput
5453
benchmark.extra_info["throughput_MiB_s_max"] = max_throughput
@@ -62,7 +61,7 @@ def publish_benchmark_extra_info(
6261
print(f" Median: {median_throughput:.2f} (approx, from median time)")
6362

6463
if true_times:
65-
throughputs = [(object_size / (1024 * 1024) * num_files) / t for t in true_times]
64+
throughputs = [total_uploaded_mib / t for t in true_times]
6665
true_min_throughput = min(throughputs)
6766
true_max_throughput = max(throughputs)
6867
true_mean_throughput = statistics.mean(throughputs)

tests/perf/microbenchmarks/conftest.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,7 @@ def _upload_worker(args):
111111

112112
def _create_files(num_files, bucket_name, bucket_type, object_size, chunk_size=1024 * 1024 * 1024):
113113
"""
114-
1. using upload_appendable_object implement this and return a list of file names.
115-
TODO: adapt this to REGIONAL BUCKETS as well.
114+
Create/Upload objects for benchmarking and return a list of their names.
116115
"""
117116
object_names = [
118117
f"{_OBJECT_NAME_PREFIX}-{uuid.uuid4().hex[:5]}" for _ in range(num_files)

tests/perf/microbenchmarks/reads/test_reads.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,6 @@ def _download_files_worker(files_to_download, other_params, chunks, bucket_type)
318318
result = download_files_using_mrd_multi_coro(
319319
loop, client, files_to_download, other_params, chunks
320320
)
321-
# logging.info(f"downloading complete for ")
322321
finally:
323322
tasks = asyncio.all_tasks(loop=loop)
324323
for task in tasks:

0 commit comments

Comments
 (0)