File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff 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 :
You can’t perform that action at this time.
0 commit comments