GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-141863: Use bytearray.take_bytes in asyncio.streams by cmaloney · Pull Request #141864 · python/cpython

Conversation

@cmaloney

@cmaloney cmaloney commented Nov 23, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Uses gh-139871 to improve performance over 10% on asyncio_tcp pyperformance benchmark. The optimization patterns here are in the take_bytes Python 3.15 What's New entry "Suggested optimizing refactors".

The "bytearray += temporary bytes" is faster than the current join pattern, and with GH-141862 should get more efficient.

tb_base.json

Performance version: 1.13.0
Python version: 3.15.0a2+ (64-bit) revision 227b9d3 Report on Linux-6.17.8-arch1-1-x86_64-with-glibc2.42 Number of logical CPUs: 32
Start date: 2025-11-22 16:18:13.127794
End date: 2025-11-22 16:18:41.207577

tb_asyncio.json

Performance version: 1.13.0
Python version: 3.15.0a2+ (64-bit) revision 6982581e422 Report on Linux-6.17.8-arch1-1-x86_64-with-glibc2.42 Number of logical CPUs: 32
Start date: 2025-11-22 16:13:46.913998
End date: 2025-11-22 16:14:14.140152

asyncio_tcp: Mean +- std dev: 169 ms +- 2 ms -> 143 ms +- 6 ms: 1.18x faster Significant (t=18.89)

asyncio_tcp_ssl: Mean +- std dev: 546 ms +- 8 ms -> 533 ms +- 6 ms: 1.02x faster Significant (t=6.02)

  • Issue: Use bytearray.take_bytes to speed up asyncio.streams #141863

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@cmaloney
pythongh-141863: Use bytearray.take_bytes in asyncio.streams
0b150fc
Uses pythongh-139871 to improve performance over 10% on asyncio_tcp
pyperformance benchmark. All the patterns optimize here are in the
`take_bytes` Python 3.15 What's New entry.

tb_base.json
============

Performance version: 1.13.0
Python version: 3.15.0a2+ (64-bit) revision 227b9d3
Report on Linux-6.17.8-arch1-1-x86_64-with-glibc2.42
Number of logical CPUs: 32
Start date: 2025-11-22 16:18:13.127794
End date: 2025-11-22 16:18:41.207577

tb_asyncio.json
===============

Performance version: 1.13.0
Python version: 3.15.0a2+ (64-bit) revision 6982581e422
Report on Linux-6.17.8-arch1-1-x86_64-with-glibc2.42
Number of logical CPUs: 32
Start date: 2025-11-22 16:13:46.913998
End date: 2025-11-22 16:14:14.140152

Mean +- std dev: 169 ms +- 2 ms -> 143 ms +- 6 ms: 1.18x faster
Significant (t=18.89)

Mean +- std dev: 546 ms +- 8 ms -> 533 ms +- 6 ms: 1.02x faster
Significant (t=6.02)
@cmaloney
cmaloney requested review from 1st1, asvetlov, kumaraditya303 and willingc as code owners November 23, 2025 00:27
@bedevere-app bedevere-app Bot added the awaiting review label Nov 23, 2025
@bedevere-app bedevere-app Bot mentioned this pull request Nov 23, 2025
Use bytearray.take_bytes to speed up asyncio.streams #141863
Closed
cmaloney added 2 commits November 22, 2025 16:33
@cmaloney
Add blurb
41f8f33
@cmaloney
Fix blurb reference
9321661
kumaraditya303
kumaraditya303 reviewed Nov 23, 2025
View reviewed changes
Comment thread Misc/NEWS.d/next/Library/2025-11-22-16-33-48.gh-issue-141863.4PLhnv.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

@kumaraditya303 kumaraditya303 added performance Performance or resource usage topic-asyncio labels Nov 23, 2025
@cmaloney
Remove gh reference
78a9caf
kumaraditya303
kumaraditya303 approved these changes Nov 24, 2025
View reviewed changes

@kumaraditya303 kumaraditya303 left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, nice speedup!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

cmaloney reacted with hooray emoji
All reactions
  • 🎉 1 reaction
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting review labels Nov 24, 2025
@kumaraditya303
kumaraditya303 merged commit b484c32 into python:main Nov 24, 2025
50 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the awaiting merge label Nov 24, 2025
@cmaloney
cmaloney deleted the asyncio_take_bytes branch November 24, 2025 18:43
StanFromIreland pushed a commit to StanFromIreland/cpython that referenced this pull request Dec 6, 2025
@cmaloney @StanFromIreland
pythongh-141863: use bytearray.take_bytes in asyncio streams for be…
962fd05
…tter performance (python#141864)
ashm-dev pushed a commit to ashm-dev/cpython that referenced this pull request Dec 8, 2025
@cmaloney @ashm-dev
pythongh-141863: use bytearray.take_bytes in asyncio streams for be…
1fd61d5
…tter performance (python#141864)
@cosmicexplorer cosmicexplorer mentioned this pull request Feb 22, 2026
Provide detection for SIMD features in autoconf and at runtime #125022
Closed
@cmaloney cmaloney mentioned this pull request Oct 22, 2026
PEP 399: exception to remove io module Python implementation _pyio python/steering-council#372
Open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@kumaraditya303 kumaraditya303 kumaraditya303 approved these changes
@1st1 1st1 Awaiting requested review from 1st1 1st1 is a code owner
@asvetlov asvetlov Awaiting requested review from asvetlov asvetlov is a code owner
@willingc willingc Awaiting requested review from willingc willingc is a code owner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

performance Performance or resource usage topic-asyncio

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@cmaloney @kumaraditya303
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.