Skip to content

gh-155152: Fix quadratic processing of concatenated zstd frames in zipimport - #155154

Open
lpyu001 wants to merge 1 commit into
python:mainfrom
lpyu001:zstdimport
Open

gh-155152: Fix quadratic processing of concatenated zstd frames in zipimport#155154
lpyu001 wants to merge 1 commit into
python:mainfrom
lpyu001:zstdimport

Conversation

@lpyu001

@lpyu001 lpyu001 commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

The implementation uses _zstd.get_frame_size() to determine the compressed size of each Zstandard frame and passes only that frame to the decompressor. A memoryview enables zero-copy slicing while advancing through the input. This ensures each compressed byte is processed once, reducing cumulative input handling from O(N²) to O(N).

@lpyu001 lpyu001 changed the title gh-155152: Fix quadratic processing of concatenated zstd frames in zi… gh-155152: Fix quadratic processing of concatenated zstd frames in zipimport Aug 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant