Skip to content

Commit f66a19c

Browse files
committed
Merge perf/cache-default-chunk-spec into perf/prepared-write-v2
# Conflicts: # src/zarr/core/array.py
2 parents 4073cff + 0cb7197 commit f66a19c

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

changes/3908.misc.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Reuse a constant `ArraySpec` during indexing when possible.

src/zarr/core/array.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5402,6 +5402,14 @@ def _get_default_chunk_spec(
54025402
For regular grids, all chunks have the same codec_shape, so we can
54035403
build the ArraySpec once and reuse it for every chunk — avoiding the
54045404
per-chunk ChunkGrid.__getitem__ + ArraySpec construction overhead.
5405+
5406+
.. note::
5407+
Ideally the per-chunk ArraySpec would not exist at all: dtype,
5408+
fill_value, config, and prototype are constant across chunks —
5409+
only the shape varies (and only for edge chunks). A cleaner
5410+
design would pass a single ArraySpec plus a per-chunk shape
5411+
override, which ChunkTransform.decode_chunk already supports
5412+
via its ``chunk_shape`` parameter.
54055413
"""
54065414
if chunk_grid.is_regular:
54075415
return ArraySpec(

0 commit comments

Comments
 (0)