[issue14687] Optimize str%tuple for the PEP 393

2012-05-03 Thread STINNER Victor
STINNER Victor added the comment: >> because I read that realloc() on Windows is not efficient. > Efficiency is not a Boolean property, you know :) Anyway, > I´d be surprised if it were very iniefficient, given that > the heap allocators on Windows are quite mature by now. My benchmark is more

[issue14687] Optimize str%tuple for the PEP 393

2012-05-03 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: > because I read that realloc() on Windows is not efficient. Efficiency is not a Boolean property, you know :) Anyway, I´d be surprised if it were very iniefficient, given that the heap allocators on Windows are quite mature by now. -- _

[issue14687] Optimize str%tuple for the PEP 393

2012-05-03 Thread Antoine Pitrou
Antoine Pitrou added the comment: > Python 3.3 @ 1439e2d1f490: > > 100 loops, best of 3: 0.265 usec per loop > 10 loops, best of 3: 11 usec per loop > 100 loops, best of 3: 0.961 usec per loop > 100 loops, best of 3: 0.924 usec per loop > > Python 3.3 @ cdc4e0f8135d: > > 1

[issue14687] Optimize str%tuple for the PEP 393

2012-05-03 Thread STINNER Victor
STINNER Victor added the comment: Results on Windows Seven 64 bits, on Intel i7 2600 @ 3.4 GHz (8 cores), Windows running in a virtual machine (kvm) with hardware virtualization. Python 3.2.2: 1000 loops, best of 3: 0.12 usec per loop 10 loops, best of 3: 5.12 usec per loop 100 lo

[issue14687] Optimize str%tuple for the PEP 393

2012-05-03 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: > Do you think that this optimization is relevant to 2.7? No, this is just an attempt to deal with the shortcomings of PEP 393. -- ___ Python tracker __

[issue14687] Optimize str%tuple for the PEP 393

2012-05-03 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: Do you think that this optimization is relevant to 2.7? In that case, it might be worthwhile for me to backport it to our EVE branch... -- nosy: +kristjan.jonsson ___ Python tracker

[issue14687] Optimize str%tuple for the PEP 393

2012-05-03 Thread Roundup Robot
Roundup Robot added the comment: New changeset f58159e5d52f by Victor Stinner in branch 'default': Issue #14687: Remove redundant length attribute of unicode_write_t http://hg.python.org/cpython/rev/f58159e5d52f -- ___ Python tracker

[issue14687] Optimize str%tuple for the PEP 393

2012-05-03 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: > Results on 32 bits (Intel Core i5 CPU 661 @ 3.33GHz) on Linux 3.0 with a new > patch. Your tests only for ascii. You should also see some of corner cases -- a large format string and a few small arguments (templating), a small simple format string and one

[issue14687] Optimize str%tuple for the PEP 393

2012-05-03 Thread Antoine Pitrou
Antoine Pitrou added the comment: > > It would be nice to have measurements under Windows. > > The differences between 32-bit Linux and 32-bit Windows should not be. The Windows memory allocator is quite different from the glibc's, so the overallocation / resizing approach may play differently

[issue14687] Optimize str%tuple for the PEP 393

2012-05-03 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: > It would be nice to have measurements under Windows. The differences between 32-bit Linux and 32-bit Windows should not be. But 64-bit can be different, and 64-bit Linux and 64-bit Windows can vary from 32-bit, and from each other. There are also difference

[issue14687] Optimize str%tuple for the PEP 393

2012-05-03 Thread Roundup Robot
Roundup Robot added the comment: New changeset 0a9143d7b097 by Victor Stinner in branch 'default': Issue #14687: Cleanup unicode_writer_prepare() http://hg.python.org/cpython/rev/0a9143d7b097 -- ___ Python tracker

[issue14687] Optimize str%tuple for the PEP 393

2012-05-03 Thread Antoine Pitrou
Antoine Pitrou added the comment: > Results on 32 bits (Intel Core i5 CPU 661 @ 3.33GHz) on Linux 3.0 with > a new patch. It would be nice to have measurements under Windows. -- ___ Python tracker ___

[issue14687] Optimize str%tuple for the PEP 393

2012-05-03 Thread STINNER Victor
Changes by STINNER Victor : -- resolution: -> fixed status: open -> closed ___ Python tracker ___ ___ Python-bugs-list mailing list U

[issue14687] Optimize str%tuple for the PEP 393

2012-05-03 Thread Roundup Robot
Roundup Robot added the comment: New changeset f1db931b93d3 by Victor Stinner in branch 'default': Issue #14687: str%tuple now uses an optimistic "unicode writer" instead of an http://hg.python.org/cpython/rev/f1db931b93d3 -- ___ Python tracker

[issue14687] Optimize str%tuple for the PEP 393

2012-05-03 Thread STINNER Victor
STINNER Victor added the comment: Results on 32 bits (Intel Core i5 CPU 661 @ 3.33GHz) on Linux 3.0 with a new patch. Python 3.2: 1000 loops, best of 3: 0.133 usec per loop 10 loops, best of 3: 4.64 usec per loop 100 loops, best of 3: 0.637 usec per loop 100 loops, best of 3:

[issue14687] Optimize str%tuple for the PEP 393

2012-05-03 Thread Roundup Robot
Roundup Robot added the comment: New changeset 830eeff4fe8f by Victor Stinner in branch 'default': Issue #14624, #14687: Optimize unicode_widen() http://hg.python.org/cpython/rev/830eeff4fe8f -- ___ Python tracker

[issue14687] Optimize str%tuple for the PEP 393

2012-05-02 Thread STINNER Victor
STINNER Victor added the comment: > Parameters of the Unicode writer (overallocation factor > and initial size) may be adjusted (later?) for better performances. I tried to compute the initial size from the args object. It is hard because we don't know how arguments are used. For example, an a

[issue14687] Optimize str%tuple for the PEP 393

2012-05-02 Thread Roundup Robot
Roundup Robot added the comment: New changeset 90b4c2d7c90d by Victor Stinner in branch 'default': Issue #14687: Optimize str%tuple for the "%(name)s" syntax http://hg.python.org/cpython/rev/90b4c2d7c90d -- ___ Python tracker

[issue14687] Optimize str%tuple for the PEP 393

2012-05-02 Thread STINNER Victor
Changes by STINNER Victor : Removed file: http://bugs.python.org/file25388/pyunicode_format.patch ___ Python tracker ___ ___ Python-bugs-list

[issue14687] Optimize str%tuple for the PEP 393

2012-05-02 Thread STINNER Victor
STINNER Victor added the comment: pyunicode_format_writer.patch: a new completly different approach. It's an optimistic patch: start with a short ASCII buffer, and grows slowly the buffer, and convert to UCS2 and maybe to UCS4 if needed. The UTF-8 decoder is based on the same idea. The patch

[issue14687] Optimize str%tuple for the PEP 393

2012-05-01 Thread Roundup Robot
Roundup Robot added the comment: New changeset 4b98ce6ef95e by Victor Stinner in branch 'default': Issue #14687: Optimize str%args http://hg.python.org/cpython/rev/4b98ce6ef95e New changeset a966f9311ebb by Victor Stinner in branch 'default': Issue #14687: Cleanup PyUnicode_Format() http://hg.p

[issue14687] Optimize str%tuple for the PEP 393

2012-04-29 Thread Roundup Robot
Roundup Robot added the comment: New changeset 42fbb4f9b540 by Victor Stinner in branch 'default': Issue #14687: Cleanup PyUnicode_Format() http://hg.python.org/cpython/rev/42fbb4f9b540 New changeset 08b54c635586 by Victor Stinner in branch 'default': Issue #14687: Avoid an useless duplicated s

[issue14687] Optimize str%tuple for the PEP 393

2012-04-29 Thread STINNER Victor
STINNER Victor added the comment: Updated patch: - use also PyUnicode_Kind for kind and fmtkind - fix compiler warnings - initialize data outside the loop - avoid duplicate PyUnicode_READ() where it is possible - minor code cleanup -- Added file: http://bugs.python.org/file25413/py

[issue14687] Optimize str%tuple for the PEP 393

2012-04-28 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I see sped up +10% on Intel Atom (but 3.2 still 2x fast). With non-ascii arguments speed up can be a little bit larger. -- nosy: +storchaka ___ Python tracker _

[issue14687] Optimize str%tuple for the PEP 393

2012-04-27 Thread STINNER Victor
New submission from STINNER Victor : PyUnicode_Format() creates short temporary substrings. Attached patch tries to avoid substrings. For example, it avoids write of 1 character and repetition of 1 character like a space. PyUnicode_Format() now works in two steps: - computes the maximum chara