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

STINNER Victor report at bugs.python.org
Thu Nov 7 01:41:01 CET 2013


STINNER Victor added the comment:

bench_list_repr.py: benchmark script. It would be interesting to run it on Windows, performances of realloc() may be different. Result on my Linux box:

Common platform:
Python unicode implementation: PEP 393
Platform: Linux-3.9.4-200.fc18.x86_64-x86_64-with-fedora-18-Spherical_Cow
Timer info: namespace(adjustable=False, implementation='clock_gettime(CLOCK_MONOTONIC)', monotonic=True, resolution=1e-09)
Timer: time.perf_counter
CFLAGS: -Wno-unused-result -Werror=declaration-after-statement -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes
Bits: int=32, long=64, long long=64, size_t=64, void*=64
CPU model: Intel(R) Core(TM) i7-2600 CPU @ 3.40GHz

Platform of campaign pyaccu:
SCM: hg revision=fafe20297927 tag=tip branch=default date="2013-11-07 00:53 +0100"
Date: 2013-11-07 01:40:23
Python version: 3.4.0a4+ (default:fafe20297927, Nov 7 2013, 01:40:19) [GCC 4.7.2 20121109 (Red Hat 4.7.2-8)]
Timer precision: 36 ns

Platform of campaign writer:
Timer precision: 40 ns
SCM: hg revision=fafe20297927+ tag=tip branch=default date="2013-11-07 00:53 +0100"
Date: 2013-11-07 01:39:59
Python version: 3.4.0a4+ (default:fafe20297927+, Nov 7 2013, 01:38:30) [GCC 4.7.2 20121109 (Red Hat 4.7.2-8)]

-----------------------------+-------------+---------------
Tests                        |      pyaccu |         writer
-----------------------------+-------------+---------------
list("a")                    |  308 ns (*) |  259 ns (-16%)
list("abc")                  |  489 ns (*) |         468 ns
["a"]*(100)                  | 8.17 us (*) |         7.8 us
["abc"]*(100)                | 8.46 us (*) |        8.88 us
["a" * 100]*(100)            | 35.2 us (*) |        36.2 us
["a"]*(10**6)                | 91.4 ms (*) | 77.3 ms (-15%)
["abc"]*(10**6)              | 96.3 ms (*) | 85.2 ms (-11%)
["a" * 100]*(10**5)          | 46.8 ms (*) | 35.1 ms (-25%)
list(range(10**6))           |  105 ms (*) |  96.9 ms (-8%)
list(map(str, range(10**6))) |  108 ms (*) | 88.7 ms (-18%)
-----------------------------+-------------+---------------
Total                        |  448 ms (*) |  383 ms (-14%)
-----------------------------+-------------+---------------

----------
Added file: http://bugs.python.org/file32521/bench_list_repr.py

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


More information about the Python-bugs-list mailing list