Message198670
> One of most used cases for bytearrays is accumulating. And the patch slow down this case.
Please don't use the raw timeit command for micro-benchmarks, it is not reliable. For example, I'm unable to reproduce your "slow down" (7% on a microbenchmark is not that large).
My micro-benchmark using my benchmark.py script:
Common platform:
Python version: 2.7.3 (default, Aug 9 2012, 17:23:57) [GCC 4.7.1 20120720 (Red Hat 4.7.1-5)]
Python unicode implementation: UCS-4
CPU model: Intel(R) Core(TM) i7-2600 CPU @ 3.40GHz
Timer: time.time
Platform: Linux-3.9.4-200.fc18.x86_64-x86_64-with-fedora-18-Spherical_Cow
Timer precision: 954 ns
CFLAGS: -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv
Bits: int=32, long=64, long long=64, size_t=64, void*=64
Platform of campaign original:
SCM: hg revision=687dd81cee3b tag=tip branch=default date="2013-09-29 22:18 +0200"
Date: 2013-09-30 00:59:42
Platform of campaign patched:
SCM: hg revision=687dd81cee3b+ tag=tip branch=default date="2013-09-29 22:18 +0200"
Date: 2013-09-30 00:59:07
------------+-------------+------------
Tests | original | patched
------------+-------------+------------
10**1 bytes | 859 ns (*) | 864 ns
10**3 bytes | 55.8 us (*) | 56.4 us
10**5 bytes | 5.42 ms | 5.41 ms (*)
10**7 bytes | 578 ms | 563 ms (*)
------------+-------------+------------
Total | 583 ms | 569 ms (*)
------------+-------------+------------
So performances are the same with the patch. |
|
Date |
User |
Action |
Args |
2013-09-29 23:01:51 | vstinner | set | recipients:
+ vstinner, pitrou, serhiy.storchaka |
2013-09-29 23:01:51 | vstinner | set | messageid: <1380495711.48.0.369275000382.issue19087@psf.upfronthosting.co.za> |
2013-09-29 23:01:51 | vstinner | link | issue19087 messages |
2013-09-29 23:01:51 | vstinner | create | |
|