Skip to content

Commit 9f6727d

Browse files
committed
Profile a few values for coalesce_max_gap
1 parent aa01ae8 commit 9f6727d

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

tests/test_codecs/test_sharding.py

Lines changed: 15 additions & 5 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:
@@ -231,10 +232,18 @@ def test_partial_shard_read_performance(store: Store) -> None:
231232

232233
num_calls = 20
233234
experiments = []
234-
for concurrency, get_latency, statement in product(
235-
[1, 10, 100], [0.0, 0.01], ["a[0, :, :]", "a[:, 0, :]", "a[:, :, 0]"]
235+
for concurrency, get_latency, coalesce_max_gap, statement in product(
236+
[1, 10, 100],
237+
[0.0, 0.01],
238+
[-1, 2**20, 10 * 2**20],
239+
["a[0, :, :]", "a[:, 0, :]", "a[:, :, 0]"],
236240
):
237-
zarr.config.set({"async.concurrency": concurrency})
241+
zarr.config.set(
242+
{
243+
"async.concurrency": concurrency,
244+
"sharding.read.coalesce_max_gap_bytes": coalesce_max_gap,
245+
}
246+
)
238247

239248
async def get_with_latency(*args: Any, get_latency: float, **kwargs: Any) -> Any:
240249
await asyncio.sleep(get_latency)
@@ -252,14 +261,15 @@ async def get_with_latency(*args: Any, get_latency: float, **kwargs: Any) -> Any
252261
experiments.append(
253262
{
254263
"concurrency": concurrency,
255-
"statement": statement,
264+
"coalesce_max_gap": coalesce_max_gap,
256265
"get_latency": get_latency,
266+
"statement": statement,
257267
"time": time,
258268
"store_get_calls": store_mock.get.call_count,
259269
}
260270
)
261271

262-
with open("zarr-python-partial-shard-read-performance.json", "w") as f:
272+
with open("zarr-python-partial-shard-read-performance-with-coalesce.json", "w") as f:
263273
json.dump(experiments, f)
264274

265275

0 commit comments

Comments
 (0)