[issue19513] Use PyUnicodeWriter instead of PyAccu in repr(tuple) and repr(list)

STINNER Victor report at bugs.python.org
Thu Nov 7 09:06:11 CET 2013


STINNER Victor added the comment:

Results on Windows 7.

Common platform:
Python unicode implementation: PEP 393
Timer info: namespace(adjustable=False, implementation='QueryPerformanceCounter(
)', monotonic=True, resolution=1e-08)
Timer: time.perf_counter
Platform: Windows-7-6.1.7601-SP1
CFLAGS: None
Bits: int=32, long=32, long long=64, size_t=32, void*=32

Platform of campaign pyaccu:
Date: 2013-11-07 08:55:58
Python version: 3.4.0a3+ (default, Nov 7 2013, 08:55:41) [MSC v.1600 32 bit (Int
el)]
Timer precision: 4.59 us
SCM: hg revision=97675195997e branch=default date="2013-10-11 23:50 +0200"

Platform of campaign writer:
Date: 2013-11-07 08:55:12
Python version: 3.4.0a3+ (default, Nov 7 2013, 08:53:13) [MSC v.1600 32 bit (Int
el)]
Timer precision: 4.55 us
SCM: hg revision=97675195997e+ branch=default date="2013-10-11 23:50 +0200"

-----------------------------+-------------+---------------
Tests                        |      pyaccu |         writer
-----------------------------+-------------+---------------
list("a")                    |  713 ns (*) |  588 ns (-17%)
list("abc")                  |  984 ns (*) |  844 ns (-14%)
["a"]*(100)                  |   12 us (*) |  9.3 us (-23%)
["abc"]*(100)                | 12.6 us (*) | 10.3 us (-18%)
["a" * 100]*(100)            | 38.7 us (*) |        39.1 us
["a"]*(10**6)                |  111 ms (*) | 91.2 ms (-18%)
["abc"]*(10**6)              |  120 ms (*) |  103 ms (-14%)
["a" * 100]*(10**5)          | 51.9 ms (*) | 58.8 ms (+13%)
list(range(10**6))           |  165 ms (*) |   152 ms (-8%)
list(map(str, range(10**6))) |  139 ms (*) |  124 ms (-11%)
-----------------------------+-------------+---------------
Total                        |  588 ms (*) |  530 ms (-10%)
-----------------------------+-------------+---------------


The following test is probably worse because of the bad performances of realloc() on Windows:

["a" * 100]*(10**5)          | 51.9 ms (*) | 58.8 ms (+13%)

----------

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


More information about the Python-bugs-list mailing list