indygreg / indygreg/python-zstandard

Implement `max_length` argument on `ZstdDecompressionObj::decompress()`

Open
#176 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
642
Forks
116
Avg merge
1d 14h
Merged PRs (30d)
5

Description

Python 3.6 added an optional max_length argument on decompressor's decompress() method. e.g. https://docs.python.org/3/library/zlib.html#zlib.Decompress.decompress.

This argument can reduce a lot of (but not all) of the performance badness in the API design of decompress() by allowing implementations to allocate a single output buffer of size max_length to avoid excessive memory allocations/copies.

We should support this optional argument.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the ZstdDecompressionObj::decompress() entry point and compare its current API with Python 3.6's zlib Decompress.decompress() documentation. Trace how output buffers are allocated, then define completion as accepting an optional max_length argument and limiting decompressed output accordingly.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, python
Domain
api
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.