[New-bugs-announce] [issue25318] Add _PyBytesWriter API to optimize Unicode encoders

STINNER Victor report at bugs.python.org
Mon Oct 5 14:01:28 CEST 2015


New submission from STINNER Victor:

Attached patch is the first step to optimize Unicode encoders: it adds a _PyBytesWriter API. This API is responsible to use the most efficient buffer depending on the need:

* it's possible to use a small buffer directly allocated on the C stack
* otherwise a Python bytes object is allocated
* it's possible to overallocate the bytes objcet to reduce the number of calls to _PyBytes_Resize()

The patch only adds the new API, don't expect any speed up. I just added a small optimization: the overallocation is disabled in UCS1 encoder (ASCII and Latin1) for the last write.

----------
components: Unicode
messages: 252322
nosy: ezio.melotti, haypo, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Add _PyBytesWriter API to optimize Unicode encoders
type: performance
versions: Python 3.6

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


More information about the New-bugs-announce mailing list