[New-bugs-announce] [issue25349] Use _PyBytesWriter for bytes%args

STINNER Victor report at bugs.python.org
Fri Oct 9 02:50:25 CEST 2015


New submission from STINNER Victor:

Attached patch is a work-in-progress patch to use the new private _PyBytesWriter API in bytes % args.

The usage of the _PyBytesWriter API will allow further optimization. For example, it avoids the creation of a temporary bytes object to format b'%f' % 1.2.

The _PyBytesWriter API allocates a small buffer of 512 bytes on the stack to delay the allocation of the final bytes objects. It can avoid the need to call _PyBytes_Resize() completly, or at least reduce the number of calls.

See also the issue #25318 which added the _PyBytesWriter API.

----------
files: bytes_format.patch
keywords: patch
messages: 252577
nosy: ethan.furman, haypo, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Use _PyBytesWriter for bytes%args
type: performance
versions: Python 3.6
Added file: http://bugs.python.org/file40724/bytes_format.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue25349>
_______________________________________


More information about the New-bugs-announce mailing list