Skip to content

Commit dafc09e

Browse files
committed
Profile a few values for coalesce_max_gap
1 parent 3555846 commit dafc09e

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

tests/test_codecs/test_sharding.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ def test_sharding_partial_read(
198198
assert np.all(read_data == 1)
199199

200200

201+
@pytest.mark.skip("This is profiling rather than a test")
201202
@pytest.mark.slow_hypothesis
202203
@pytest.mark.parametrize("store", ["local"], indirect=["store"])
203204
def test_partial_shard_read_performance(store: Store) -> None:
@@ -230,21 +231,29 @@ def test_partial_shard_read_performance(store: Store) -> None:
230231

231232
num_calls = 20
232233
experiments = []
233-
for concurrency, statement in product([1, 10, 100], ["a[0, :, :]", "a[:, 0, :]", "a[:, :, 0]"]):
234+
for concurrency, coalesce_max_gap, statement in product(
235+
[1, 10, 100], [-1, 2**20, 10 * 2**20], ["a[0, :, :]", "a[:, 0, :]", "a[:, :, 0]"]
236+
):
234237
store_mock.reset_mock()
235-
zarr.config.set({"async.concurrency": concurrency})
238+
zarr.config.set(
239+
{
240+
"async.concurrency": concurrency,
241+
"sharding.read.coalesce_max_gap_bytes": coalesce_max_gap,
242+
}
243+
)
236244
# Each timeit call accesses a 512x512 slice covering 64 chunks
237245
time = timeit(statement, number=num_calls, globals={"a": a}) / num_calls
238246
experiments.append(
239247
{
240248
"concurrency": concurrency,
249+
"coalesce_max_gap": coalesce_max_gap,
241250
"statement": statement,
242251
"time": time,
243252
"store_get_calls": store_mock.get.call_count,
244253
}
245254
)
246255

247-
with open("zarr-python-partial-shard-read-performance.json", "w") as f:
256+
with open("zarr-python-partial-shard-read-performance-with-coalesce.json", "w") as f:
248257
json.dump(experiments, f)
249258

250259

0 commit comments

Comments
 (0)