| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
PyBytesWriter_Resize() and PyBytesWriter_Grow() no longer overallocate when the first bytes/bytearray object is allocated. Only overallocate bytes objects at next PyBytesWriter_Resize() and PyBytesWriter_Grow() calls.
|
See PR gh-158615 "io.BufferedReader.readline()" change. Combining the two PRs make io.BufferedReader.readline() up to 1.13x faster (but 1.05x in the corner cases of lines 10x longer than the io.BufferedReader buffer size). |
Sorry, something went wrong.
|
I ran again benchmarks on top of the memchr() optimization:
Benchmark 1 results:
Benchmark hidden because not significant (2): Modules/_io/bufferedio.c, Lib/typing.py Benchmark 2 result: Mean +- std dev: [main_lines] 268 us +- 5 us -> [change_lines] 306 us +- 24 us: 1.14x slower So this optimization actually makes readline() slower in most benchmarks. I close this PR, it was a bad idea :-) Overallocation is efficient and it's good to use it. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
PyBytesWriter_Resize() and PyBytesWriter_Grow() no longer overallocate when the first bytes/bytearray object is allocated. Only overallocate bytes objects at next PyBytesWriter_Resize() and PyBytesWriter_Grow() calls.