diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2015-10-09 09:48:06 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2015-10-09 09:48:06 (GMT) |
commit | fa7762ec066aa3632a25b6a52bb7597b8f17c2f3 (patch) | |
tree | 9f14bcc1d8c0f316c5e9f5dcc549686fff42340b /Include/bytesobject.h | |
parent | bd5f0e8c1cf633a238c10e1d3199c0d572a4df1d (diff) | |
download | cpython-fa7762ec066aa3632a25b6a52bb7597b8f17c2f3.zip cpython-fa7762ec066aa3632a25b6a52bb7597b8f17c2f3.tar.gz cpython-fa7762ec066aa3632a25b6a52bb7597b8f17c2f3.tar.bz2 |
Issue #25349: Optimize bytes % args using the new private _PyBytesWriter API
* Thanks to the _PyBytesWriter API, output smaller than 512 bytes are allocated
on the stack and so avoid calling _PyBytes_Resize(). Because of that, change
the default buffer size to fmtcnt instead of fmtcnt+100.
* Rely on _PyBytesWriter algorithm to overallocate the buffer instead of using
a custom code. For example, _PyBytesWriter uses a different overallocation
factor (25% or 50%) depending on the platform to get best performances.
* Disable overallocation for the last write.
* Replace C loops to fill characters with memset()
* Add also many comments to _PyBytes_Format()
* Remove unused FORMATBUFLEN constant
* Avoid the creation of a temporary bytes object when formatting a floating
point number (when no custom formatting option is used)
* Fix also reference leaks on error handling
* Use Py_MEMCPY() to copy bytes between two formatters (%)
Diffstat (limited to 'Include/bytesobject.h')
0 files changed, 0 insertions, 0 deletions