Repository navigation
feat: add C-order option for writing sub chunks within shards - #364
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! 🚀 New features to boost your workflow:
|
843e5d7 to
c79168e
Compare
c79168e to
10011de
Compare
LDeakin
left a comment
There was a problem hiding this comment.
Nice, this is quality! Just a few minor things
I might follow this up with something like https://github.com/zarrs/zarrs/tree/feat/codec_specific_options before releasing because I want to keep codec-specific options decoupled from zarrs_codec.
I can imagine some extra options for sharding. E.g. write to reserved fixed/bounded size regions to enable concurrent partial encoding of subchunks. Shards can be compacted later.
That totally makes sense - happy to merge that branch into this one and then update where
No doubt - page aligned for sure too :) This is moving towards composing options which is cool i.e., "bounded size region + page aligned + C" or just "page aligned + morton" Definitely makes splitting off the options more attractive |
|
#366 merged |
Background
While investigating zarrs/zarrs-python#152, I discovered that within-shard reads are random in zarrs (which took way longer than I'd like to admit). Even after merging sub chunks and removing the big copy (#358 + #362) the partial reads were still crazy slow. The reason turned out to be the sub chunk layout on disk did not match my mental image.
Solution
I'm adding
subchunk_write_orderhere as an option onCodecOptionswith two possible values as of writing - C-ordering and Randomized (default). Then on calls toShardingCodec.encode, the correct branch is taken (for only bounded arrays as of writing).Maybe TODOs (now or open issue for later):
If the design here makes sense, I'd apply this toI think independent of whether or not the "design" is right (i.e., a global option orencode_unboundedas well especially since it seems like an even lighter refactor there - encoding and writing are already split so we would just slot in between those two steps with this option.CodecOption),encode_unboundedmakes sense so I've refactored to implement that.u64. But there is also a crate that does seem to be actively maintained as well (see note inCodecOptions: https://docs.rs/morton-encoding/latest/morton_encoding/)zarr_benchmarks). I have already tried out the combination of zarr-python write order with perf: merge adjacent subchunk reads #358 and can confirm that it gives (the expected) 20x speedup I have come to expect from doing sequential I/o (in my use case).