You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Use bytearray.take_bytes to speed up asyncio.streams #141863
Multiple codepaths in asyncio.streams operate on self._buffer (a bytearray) and then "take" (copy and delete bytes from original) when returning or passing them to other functions. That code pattern can be optimized with .take_bytes() added in gh-139871
Pyperformance:
tb_base.json
============
Performance version: 1.13.0
Python version: 3.15.0a2+ (64-bit) revision 227b9d326ec
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)
Activity
pythongh-141863: Use bytearray.take_bytes in asyncio.streams
gh-141863: use `bytearray.take_bytes` in asyncio streams for better p…
pythongh-141863: use `bytearray.take_bytes` in asyncio streams for be…
pythongh-141863: use `bytearray.take_bytes` in asyncio streams for be…