FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-129813, PEP 782: Use PyBytesWriter in bytes_concat() by vstinner · Pull Request #138840 · python/cpython · GitHub

Repository navigation

gh-129813, PEP 782: Use PyBytesWriter in bytes_concat() - #138840

Closed
vstinner wants to merge 1 commit into
python:mainfrom
vstinner:pybyteswriter_bytes_concat
Closed

vstinner wants to merge 1 commit into
python:mainfrom
vstinner:pybyteswriter_bytes_concat

Conversation

vstinner commented Sep 12, 2025 •
edited by bedevere-app Bot
Loading

Copy link
Copy Markdown
Member

Replace PyBytes_FromStringAndSize(NULL, size) with the new public PyBytesWriter API.

Replace PyBytes_FromStringAndSize(NULL, size) with the new public
PyBytesWriter API.

Copy link
Copy Markdown
Member Author

Microbenchmark on bytes + bytes:

python -m pyperf timeit -s 'a=b"a"; b=b"b"' 'a+b'

Result: Mean +- std dev: [ref] 38.0 ns +- 1.1 ns -> [pep782] 52.7 ns +- 1.7 ns: 1.39x slower.

Oh, this change has a significant impact on performance. I prefer to abandon it.

vstinner closed this Sep 13, 2025
vstinner deleted the pybyteswriter_bytes_concat branch September 13, 2025 17:05
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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


Back | FazBrowse Home | New Git URL