Skip to content

Commit

Permalink
PRF: improve performance using bigger chunks
Browse files Browse the repository at this point in the history
  • Loading branch information
tacaswell committed Feb 11, 2025
1 parent 7531299 commit fbbfd76
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tiled/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ def __iter__(self) -> Iterator[Any]:

def __getitem__(self, key: str) -> ArrayAdapter:
value = self._group[key]
chunks = value.chunks
shape = value.shape
c0 = min(20*chunks[0], shape[0])

md = dict(value.attrs)
if value.dtype == numpy.dtype("O"):
Expand All @@ -155,8 +158,8 @@ def __getitem__(self, key: str) -> ArrayAdapter:
arr = numpy.array(dataset_names)
return ArrayAdapter.from_array(arr, metadata=md)
return ArrayAdapter.from_array(numpy.array([]), metadata=md)
return ArrayAdapter.from_array(value, metadata=md)

return ArrayAdapter.from_array(value, metadata=md, chunks=(c0, *chunks[1:]))
def __len__(self) -> int:
return 2

Expand Down

0 comments on commit fbbfd76

Please sign in to comment.