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 <rep...@bugs.python.org>
<http://bugs.python.org/issue25349>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to