-
-
Notifications
You must be signed in to change notification settings - Fork 387
perf/store sync #3725
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
Open
d-v-b
wants to merge
16
commits into
zarr-developers:main
Choose a base branch
from
d-v-b:perf/store-sync
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+436
−7
Open
perf/store sync #3725
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
2b64daa
add sync methods to codecs
d-v-b cd4efb0
add CodecChain dataclass and sync codec tests
d-v-b 41b7a6a
refactor codecchain
d-v-b 5a2a884
separate codecs and specs
d-v-b 4e262b1
add synchronous methods to stores
d-v-b 34b30a1
Merge branch 'main' into perf/store-sync
d-v-b 8cb35d9
fix merge error
d-v-b 9710a74
guard storepath methods that rely on underlying sync impl
d-v-b c0c1b24
scrub out set-range logic
d-v-b b36a2d4
remove is-zstd-fixed-size test
d-v-b acb6c25
remove codecchain
d-v-b 71b6643
Merge branch 'main' into perf/store-sync
dcherian 748657d
Merge branch 'main' into perf/store-sync
d-v-b cdfb3c3
Merge branch 'main' into perf/store-sync
d-v-b 25585b9
Merge branch 'main' into perf/store-sync
d-v-b 29d12e6
revert delete comment
d-v-b File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| from __future__ import annotations | ||
|
|
||
| import numpy as np | ||
|
|
||
| from zarr.abc.codec import SupportsSyncCodec | ||
| from zarr.codecs.crc32c_ import Crc32cCodec | ||
| from zarr.core.array_spec import ArrayConfig, ArraySpec | ||
| from zarr.core.buffer import default_buffer_prototype | ||
| from zarr.core.dtype import get_data_type_from_native_dtype | ||
|
|
||
|
|
||
| def test_crc32c_codec_supports_sync() -> None: | ||
| assert isinstance(Crc32cCodec(), SupportsSyncCodec) | ||
|
|
||
|
|
||
| def test_crc32c_codec_sync_roundtrip() -> None: | ||
| codec = Crc32cCodec() | ||
| arr = np.arange(100, dtype="float64") | ||
| zdtype = get_data_type_from_native_dtype(arr.dtype) | ||
| spec = ArraySpec( | ||
| shape=arr.shape, | ||
| dtype=zdtype, | ||
| fill_value=zdtype.cast_scalar(0), | ||
| config=ArrayConfig(order="C", write_empty_chunks=True), | ||
| prototype=default_buffer_prototype(), | ||
| ) | ||
| buf = default_buffer_prototype().buffer.from_array_like(arr.view("B")) | ||
|
|
||
| encoded = codec._encode_sync(buf, spec) | ||
| assert encoded is not None | ||
| decoded = codec._decode_sync(encoded, spec) | ||
| result = np.frombuffer(decoded.as_numpy_array(), dtype="float64") | ||
| np.testing.assert_array_equal(arr, result) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
is this necessary?
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.
yes. in our current
Storedesign, creating an instance of a store doesn't necessarily "open" it, so we have an asyncopenmethod that actually opens the store. Our asyncget/setmethods guard against the store being un-open:zarr-python/src/zarr/storage/_local.py
Lines 199 to 200 in b6d3ae2