feat: add ZarrsArray#147
Conversation
|
I love this!
See zarr-developers/zarr-python#3678. Telling claude to copy tensorstore works great! |
|
I am very much so in favor of this because I really abuse this chunk-iteration API and do notice this performance hit. Do you think the performance hit comes from creating many small rust classes? Or is it in zarr-python before we even see the individual chunk selections? Just wondering out loud for the current state of things, could we make https://github.com/zarrs/zarrs-python/blob/main/python/zarrs/utils.py simpler? I wonder if the creation of a list of selection-out-shape objects or selections/outs/shapes individually specifically could be rust-ified if we could guarantee from zarr-python that the input to it is always a I would be very open to dropping this Similar/related to this could be an API that the base Directly to the question of
could be just monkey-patching the |
I'd guess the latter, but I haven't done any profiling. And in regards to everything else you mentioned, I'd say the more we can do in Rust the better, but I have no idea what is feasible. |
|
Closing so that |
|
Hi, it's me again, I am working on bringing native vindex with GIL released. So I found something that might be useful for you guys. I noticed in my branch, even though I added some optimizations on rust level, BasicIndexer would always beat MultiIndexer. Then I did some profiling and noticed there is a algorithmic problem there. So here is the AI written report. Following up on your question in #147:
At least part of it is the latter, and it's measurable in isolation: 1. Isolated, pure zarr-python (no zarrs, no I/O, no storage)
Two things: the coordinate path is 5–7× more expensive, and it scales with the number of Same script on an HPC compute node (Xeon, slower single-thread) — ratio and scaling hold,
2. Where the time goes (cProfile, 4096-run build ×30)Every one of these is a full O(n_elements) numpy pass. For a sorted, contiguous-run 1-D Takeaway
Repro:
|
This is a POC for using
zarrs'Arrayfrom python. Nativezarrsperformance in Python 🚀🚀🚀. It just layers overzarr.Arrayand replaces__getitem__and__setitem__. The advantage over the codec pipeline is that all chunking logic / reassembly happens on the Rust side.It'd be amazing if there was some way to make this usable by
zarr-python(similarly to the codec pipeline) sodasketc can use it.Also maybe it should be lazy by default, currently opt-in with
.lazyRound trip benchmark
Disclosure: I haven't reviewed this thoroughly, Claude did most of the implementation.