You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Sad Catapella B3][Performance] Misaligned Zarr block reads may decode the same chunk repeatedly #78
Baseline:d7a538e56d41ac1093ba79adcad397c21b3dfd32. Classification: confirmed sub-chunk repeated-slice access pattern; decompression/caching cost is an unmeasured performance hypothesis.
Evidence:_choose_block() lines 1021–1058 permits partial rows; _ranges() makes multiple sub-chunk ranges; _zarr_layout() lines 1338–1385 always enables partial_rows=True; _zarr_plane() lines 1392–1404 executes a separate Zarr array[selection] for each range. On compressed Zarr stores, each sub-chunk selection may trigger another whole-chunk decode absent effective caching. The same blocks are revisited across histogram passes via the pinned normalization brick (compute_block_histogram). Test asserts pixel correctness of sub-chunk reads, not decode counts or throughput.
Impact: Very poor I/O/decompression efficiency when chunk Y is large relative to affordable block rows, especially remote/object stores and robust histogram passes. No measured slowdown is asserted.
Fix: instrument actual store get/decompress calls; compare chunk-aligned reads, cache-by-chunk with explicit memory bound, and rechunking/preprocessing options. Avoid assuming smaller NumPy selection means smaller decompression. Include 1/2/4-D chunk shapes spanning channels and planes; compression=none/lz4/zstd; local SSD and network object store where available; RSS, decompressed bytes, storage requests and wall time. No Numba role for codec/I/O itself.
Measured on real data for #529 (draft PR #571, main at 316be56, zarr 3.4.2). Store reads were counted with a wrapper on LocalStore.get. Values are identical to an eager read.
SSBD Airyscan store (3 channels × 58 Z, 844² uint16 chunks, blosc zstd). At an 8 MiB limit the blocks are 29 × 844, so 30 blocks per 844-row chunk. That gives 120 store reads and about 37 MiB read per channel-plane for 2 MiB stored: each block reads the shard index and the whole chunk again. At 1 GiB, read whole, it is 2 reads per channel-plane.
SSBD brain slice (3 × 9180 × 13264 uint8, 2295 × 3316 chunks). At 64 MiB the blocks are 55 × 13264. Three channel-planes read 3345 MiB from a 40 MiB store in 15.8 s. At 1 GiB (2295-row blocks) it is 80 MiB in 3.8 s.
These counts include two passes over the blocks: one blocks() pass by the script, and the histogram pass. An 8- or 16-bit histogram needs one pass.
Activity
guijacquemet commentedon Nov 24, 2026
Owner (24 Nov 2026): nice to have, later — labelled enhancement.
Generated by Claude Code
guijacquemet commentedon Nov 26, 2026
Measured on real data for #529 (draft PR #571,
mainat316be56, zarr 3.4.2). Store reads were counted with a wrapper onLocalStore.get. Values are identical to an eager read.uint16chunks, blosc zstd). At an 8 MiB limit the blocks are 29 × 844, so 30 blocks per 844-row chunk. That gives 120 store reads and about 37 MiB read per channel-plane for 2 MiB stored: each block reads the shard index and the whole chunk again. At 1 GiB, read whole, it is 2 reads per channel-plane.uint8, 2295 × 3316 chunks). At 64 MiB the blocks are 55 × 13264. Three channel-planes read 3345 MiB from a 40 MiB store in 15.8 s. At 1 GiB (2295-row blocks) it is 80 MiB in 3.8 s.These counts include two passes over the blocks: one
blocks()pass by the script, and the histogram pass. An 8- or 16-bit histogram needs one pass.Generated by Claude Code