[issue25349] Use _PyBytesWriter for bytes%args

2016-04-26 Thread Roundup Robot
Roundup Robot added the comment: New changeset 090502a0c69c by Victor Stinner in branch 'default': Issue #25349, #26249: Fix memleak in formatfloat() https://hg.python.org/cpython/rev/090502a0c69c -- ___ Python tracker

[issue25349] Use _PyBytesWriter for bytes%args

2015-10-09 Thread STINNER Victor
STINNER Victor added the comment: Ok, I implemented all optimizations which were already implemented in str % args. I close the issue. -- resolution: -> fixed status: open -> closed ___ Python tracker ___

[issue25349] Use _PyBytesWriter for bytes%args

2015-10-09 Thread Roundup Robot
Roundup Robot added the comment: New changeset d9a89c9137d2 by Victor Stinner in branch 'default': Issue #25349: Optimize bytes % int https://hg.python.org/cpython/rev/d9a89c9137d2 New changeset 4d46d1588629 by Victor Stinner in branch 'default': Issue #25349: Add fast path for b'%c' % int https

[issue25349] Use _PyBytesWriter for bytes%args

2015-10-09 Thread STINNER Victor
STINNER Victor added the comment: I wrote bench_bytes_int.py micro-benchmark, results are below. Oh, I did'n expected a real difference even for simple code like b'%d' % 12345 (32% faster). So I consider that it's enough to apply the optimization. Common platform: Timer: time.perf_counter Bits

[issue25349] Use _PyBytesWriter for bytes%args

2015-10-09 Thread STINNER Victor
STINNER Victor added the comment: bytes_formatlong.patch: Fast-path for b'%d' % int and other integer formatters. It avoids the creation of a temporary bytes object, it writes directly into the writer, as '%d' % int (Unicode). -- Added file: http://bugs.python.org/file40732/bytes_forma

[issue25349] Use _PyBytesWriter for bytes%args

2015-10-09 Thread Roundup Robot
Roundup Robot added the comment: New changeset b2f3cbdc0f2d by Victor Stinner in branch 'default': Issue #25349: Optimize bytes % args using the new private _PyBytesWriter API https://hg.python.org/cpython/rev/b2f3cbdc0f2d -- nosy: +python-dev ___ Pyt

[issue25349] Use _PyBytesWriter for bytes%args

2015-10-09 Thread STINNER Victor
STINNER Victor added the comment: bench_bytes_format.py: micro-benchmark testing a few formats. Some tests are focused on the implementation of _PyBytesWriter to ensure that the optimization is efficient. Except of a single test (which is not really revelant, it takes less than 500 nanosecond

[issue25349] Use _PyBytesWriter for bytes%args

2015-10-08 Thread STINNER Victor
STINNER Victor added the comment: See also the PEP 461 "Adding % formatting to bytes and bytearray". FYI bytes % args is tested by test_format (good to know to test quickly changes). -- ___ Python tracker ___

[issue25349] Use _PyBytesWriter for bytes%args

2015-10-08 Thread STINNER Victor
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.