Skip to content

Conversation

@cmaloney
Copy link
Contributor

@cmaloneycmaloney commented Nov 23, 2025

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)

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)
@kumaraditya303kumaraditya303 added performance Performance or resource usage topic-asyncio labels Nov 23, 2025
@Sanel0101Sanel0101 mentioned this pull request Nov 24, 2025
Copy link
Contributor

@kumaraditya303kumaraditya303 left a comment

Choose a reason for hiding this comment

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

LGTM, nice speedup!

@kumaraditya303kumaraditya303 merged commit b484c32 into python:mainNov 24, 2025
50 checks passed
@cmaloneycmaloney 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
ashm-dev pushed a commit to ashm-dev/cpython that referenced this pull request Dec 8, 2025
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performancePerformance or resource usagetopic-asyncio

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@cmaloney@kumaraditya303