Skip to content

Conversation

@miss-islington
Copy link
Contributor

@miss-islington miss-islington commented Jul 5, 2021

  • zlib uses an UINT32_MAX sliding window for the output buffer

These funtions have an initial output buffer size parameter:

  • zlib.decompress(data, /, wbits=MAX_WBITS, bufsize=DEF_BUF_SIZE)
  • zlib.Decompress.flush([length])

If the initial size > UINT32_MAX, use an UINT32_MAX sliding window, instead of clamping to UINT32_MAX.
Speed up when (the initial size == the actual size).

This fixes a memory consumption and copying performance regression in earlier 3.10 beta releases if someone used an output buffer larger than 4GiB with zlib.decompress.

Reviewed-by: Gregory P. Smith
(cherry picked from commit a9a69bb)

Co-authored-by: Ma Lin animalize@users.noreply.github.com

https://bugs.python.org/issue41486

Automerge-Triggered-By: GH:gpshead

…er (pythonGH-26143) * zlib uses an UINT32_MAX sliding window for the output buffer These funtions have an initial output buffer size parameter: - zlib.decompress(data, /, wbits=MAX_WBITS, bufsize=DEF_BUF_SIZE) - zlib.Decompress.flush([length]) If the initial size > UINT32_MAX, use an UINT32_MAX sliding window, instead of clamping to UINT32_MAX. Speed up when (the initial size == the actual size). This fixes a memory consumption and copying performance regression in earlier 3.10 beta releases if someone used an output buffer larger than 4GiB with zlib.decompress. Reviewed-by: Gregory P. Smith (cherry picked from commit a9a69bb) Co-authored-by: Ma Lin <animalize@users.noreply.github.com>
@miss-islington
Copy link
Contributor Author

@animalize and @gpshead: Status check is done, and it's a success ✅ .

@bedevere-bot bedevere-bot added type-bug An unexpected behavior, bug, or error performance Performance or resource usage awaiting review labels Jul 5, 2021
@miss-islington
Copy link
Contributor Author

@animalize and @gpshead: Status check is done, and it's a success ✅ .

@miss-islington miss-islington merged commit 22bcc07 into python:3.10 Jul 5, 2021
@miss-islington miss-islington deleted the backport-a9a69bb-3.10 branch July 5, 2021 01:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance Performance or resource usage type-bug An unexpected behavior, bug, or error

4 participants