-
-
Notifications
You must be signed in to change notification settings - Fork 304
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DOC: Add memory-mapping example to storage guide #2737
base: main
Are you sure you want to change the base?
Conversation
Fixes zarr-developers#1245 Add documentation and tests for memory-mapped store, focusing on efficient access to small slices from large uncompressed chunks.
def _fromfile(self, fn: str) -> memoryview: | ||
with open(fn, "rb") as fh: | ||
return memoryview(mmap.mmap(fh.fileno(), 0, prot=mmap.PROT_READ)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think _fromfile
will ever be invoked, since it's not part of the LocalStore
API
thanks for this addition, however I do think it's worth thinking about whether a special store subclass is the right approach here. Presumably any store the supports range reads also supports reading slices from uncompressed chunks, so just subclassing |
That's true. Would it be better to implement this as a codec? |
I think this logic should probably live in the
|
True, but let's focus on reading for now.
This will be very dependent on the use case. We can add a flag for this and have it set to false by default for backwards compatibility. Then the user can switch the flag as needed. |
So it sounds like you want a more integrated solution than an ad hoc override? How would you feel about adding this here until we have a more robust and integrated solution? |
I don't think the proposed changes here actually implement anything, since the |
Fixes #1245
Add documentation and tests for memory-mapped store, focusing on efficient access to small slices from large uncompressed chunks.
TODO:
docs/user-guide/*.rst
docs/release-notes.rst