[New-bugs-announce] [issue25399] Optimize bytearray % args

STINNER Victor report at bugs.python.org
Wed Oct 14 02:42:28 CEST 2015


New submission from STINNER Victor:

Optimize bytearray % args

Don't create temporary bytes objects: modify _PyBytes_Format() to create work
directly on bytearray objects.

* _PyBytesWriter: add use_bytearray attribute to use a bytearray buffer
* Rename _PyBytes_Format() to _PyBytes_FormatEx() just in case if something
  outside CPython uses it
* _PyBytes_FormatEx() now uses (char*, Py_ssize_t) for the input string, so
  bytearray_format() doesn't need tot create a temporary input bytes object
* Add use_bytearray parameter to _PyBytes_FormatEx() which is passed to
  _PyBytesWriter, to create a bytearray buffer instead of a bytes buffer

----------
files: bytearray_format.patch
keywords: patch
messages: 252970
nosy: haypo, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Optimize bytearray % args
type: performance
versions: Python 3.6
Added file: http://bugs.python.org/file40776/bytearray_format.patch

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


More information about the New-bugs-announce mailing list