gh-134938: Add set_pledged_input_size to ZstdCompressor #135010
gh-134938: Add set_pledged_input_size to ZstdCompressor #135010serhiy-storchaka merged 17 commits intopython:mainfrom
set_pledged_input_size to ZstdCompressor #135010Conversation
|
cc @Rogdham |
Also fixup punctuation usage and don't incref Py_None.
| The *mode* argument is a :class:`ZstdCompressor` attribute, either | ||
| :attr:`~.FLUSH_BLOCK`, or :attr:`~.FLUSH_FRAME`. | ||
|
|
||
| .. method:: set_pledged_input_size(size) |
There was a problem hiding this comment.
This doesn't currently explain why one would want to use the method.
There was a problem hiding this comment.
I added a bit to describe this, but suggestions welcome.
serhiy-storchaka
left a comment
There was a problem hiding this comment.
I think that mark up should be cleaned up, but there are many occurrences of ~. in existing documentation, so this can be done in a following PR.
Otherwise LGTM. 👍
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
…python into zstd-set-pledged-input-size
|
@serhiy-storchaka
I'll make a follow up after this is merged to resolve these. |
|
Thanks @emmatyping for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14. |
…onGH-135010) (cherry picked from commit 4b44b34) Co-authored-by: Emma Smith <emma@emmatyping.dev>
|
GH-135173 is a backport of this pull request to the 3.14 branch. |
This PR adds a new method
set_pledged_input_size(), which allows users to declare up front how much data will be written to the compressor for a given frame. This combined withCompressionParameter.content_size_flagallows users to ensure that even for streaming compression scenarios the content size is written into the zstd frame header, which is beneficial for reducing decompression memory usage.📚 Documentation preview 📚: https://cpython-previews--135010.org.readthedocs.build/