Skip to content

Optimize multipart request body allocations - #101

Open
rschlaikjer wants to merge 2 commits into
masterfrom
rs-multipart-encode-opt
Open

Optimize multipart request body allocations#101
rschlaikjer wants to merge 2 commits into
masterfrom
rs-multipart-encode-opt

Conversation

@rschlaikjer

Copy link
Copy Markdown
Contributor

The requests library hands multipart fields to urllib3, which appends each part to a BytesIO.
This reallocates and copies on each resize, and the final getvalue() copies again.
Joining a list of binary parts instead computes the final size up front, and copies only once.

@rschlaikjer
rschlaikjer requested review from woswos and ziyan August 27, 2026 09:08
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.

1 participant