Commit cdb5846
perf: cache default ArraySpec for regular chunk grids (#3908)
* perf: cache default ArraySpec for regular chunk grids
For regular grids, all chunks have the same codec_shape, so we can
build the ArraySpec once and reuse it for every chunk — avoiding the
per-chunk ChunkGrid.__getitem__ + ArraySpec construction overhead.
Adds _get_default_chunk_spec() and uses it in _get_selection and
_set_selection. Saves ~5ms per 1000 chunks.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* docs: changelog
* refactor: inline creation of default arrayspec
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent f2321ec commit cdb5846
2 files changed
Lines changed: 29 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5427 | 5427 | | |
5428 | 5428 | | |
5429 | 5429 | | |
| 5430 | + | |
| 5431 | + | |
| 5432 | + | |
| 5433 | + | |
| 5434 | + | |
| 5435 | + | |
| 5436 | + | |
| 5437 | + | |
| 5438 | + | |
| 5439 | + | |
| 5440 | + | |
5430 | 5441 | | |
5431 | 5442 | | |
5432 | 5443 | | |
5433 | 5444 | | |
5434 | | - | |
| 5445 | + | |
| 5446 | + | |
| 5447 | + | |
5435 | 5448 | | |
5436 | 5449 | | |
5437 | 5450 | | |
| |||
5770 | 5783 | | |
5771 | 5784 | | |
5772 | 5785 | | |
| 5786 | + | |
| 5787 | + | |
| 5788 | + | |
| 5789 | + | |
| 5790 | + | |
| 5791 | + | |
| 5792 | + | |
| 5793 | + | |
| 5794 | + | |
| 5795 | + | |
| 5796 | + | |
5773 | 5797 | | |
5774 | 5798 | | |
5775 | 5799 | | |
5776 | 5800 | | |
5777 | | - | |
| 5801 | + | |
| 5802 | + | |
| 5803 | + | |
5778 | 5804 | | |
5779 | 5805 | | |
5780 | 5806 | | |
| |||
0 commit comments