Skip to content

Commit 5cef539

Browse files
committed
Add another todo
1 parent 2d0499a commit 5cef539

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/zarr/core/chunk_grids.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,12 @@ class VaryingDimension:
137137
nchunks: int = field(init=False, repr=False) # cached at construction
138138
ngridcells: int = field(init=False, repr=False) # cached at construction
139139

140-
# TODO: with_extent/resize re-create VaryingDimension with the same edges,
141-
# recomputing cumulative sums (O(n)) and nchunks (bisect). For long
142-
# dimensions, add a fast path that reuses the existing cumulative tuple.
140+
# TODO(perf): for long dimensions (O(million chunks)):
141+
# - with_extent/resize recompute cumulative sums and nchunks from scratch;
142+
# add a fast path that reuses the existing cumulative tuple.
143+
# - Consider storing cumulative as ndarray so bisect calls can use
144+
# np.searchsorted. Scalar lookups (chunk_offset, index_to_chunk)
145+
# would need benchmarking to confirm no regression.
143146
def __init__(self, edges: Sequence[int], extent: int) -> None:
144147
edges_tuple = tuple(edges)
145148
if not edges_tuple:

0 commit comments

Comments
 (0)