Skip to content

perf: add sync methods to codecs#3721

Merged
d-v-b merged 5 commits intozarr-developers:mainfrom
d-v-b:perf/sync-codec-protocol
Feb 28, 2026
Merged

perf: add sync methods to codecs#3721
d-v-b merged 5 commits intozarr-developers:mainfrom
d-v-b:perf/sync-codec-protocol

Conversation

@d-v-b
Copy link
Contributor

@d-v-b d-v-b commented Feb 25, 2026

This PR adds synchronous encode / decode methods to our codecs, and a protocol that models this behavior. These methods will be used in future improvements to the chunk encoding process. Async is a pure performance tax for CPU-limited operations like compression. These methods allow us to avoid that async overhead.

Part of #3720

TODO:

  • Add unit tests and/or doctests in docstrings
  • Add docstrings and API docs for any new/modified user-facing classes and functions
  • New/modified features documented in docs/user-guide/*.md
  • Changes documented as a new file in changes/
  • GitHub Actions have all passed
  • Test coverage is 100% (Codecov passes)

@github-actions github-actions bot added the needs release notes Automatically applied to PRs which haven't added release notes label Feb 25, 2026
Comment on lines +71 to +73
def _decode_sync(
self, chunk_data: NDBuffer | Buffer, chunk_spec: ArraySpec
) -> NDBuffer | Buffer: ...
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this reminds me that it makes no sense for our bytes-bytes codecs to take an arrayspec parameter for encoding / decoding. we need to fix that down the road.

This was referenced Feb 26, 2026
@d-v-b d-v-b force-pushed the perf/sync-codec-protocol branch from 57886a6 to 2b64daa Compare February 28, 2026 14:15
@github-actions github-actions bot removed the needs release notes Automatically applied to PRs which haven't added release notes label Feb 28, 2026
@d-v-b d-v-b enabled auto-merge (squash) February 28, 2026 14:27
@d-v-b d-v-b merged commit d926e43 into zarr-developers:main Feb 28, 2026
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants