This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients josh.r, pitrou, vstinner
Date 2014-05-02.21:10:14
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1399065015.51.0.725173698422.issue21419@psf.upfronthosting.co.za>
In-reply-to
Content
> Looks like you forgot to actually use the use_calloc parameter you put in the long_alloc prototype. It accepts it, but it's never used or passed to another function.

Oh f###, you're right. See new patch.

I ran again the new benchmark: my (updated) patch makes most operations slower, except for "1 << (2 ** 28)". For 1 << (2 ** 28), it's much faster, but it is worth to modify long_lshift() for this rare use case?


Updated benchmark:

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

Platform of campaign orig:
Python version: 3.5.0a0 (default:5b0fda8f5718, May 2 2014, 22:47:06) [GCC 4.8.2 20131212 (Red Hat 4.8.2-7)]
SCM: hg revision=5b0fda8f5718 tag=tip branch=default date="2014-05-02 22:31 +0200"
Timer precision: 46 ns
Date: 2014-05-02 22:47:12

Platform of campaign calloc2:
Python version: 3.5.0a0 (default:5b0fda8f5718+, May 2 2014, 23:04:59) [GCC 4.8.2 20131212 (Red Hat 4.8.2-7)]
Date: 2014-05-02 23:05:23
SCM: hg revision=5b0fda8f5718+ tag=tip branch=default date="2014-05-02 22:31 +0200"
Timer precision: 45 ns

----------------+-------------+----------------
Tests           |        orig |         calloc2
----------------+-------------+----------------
1 << (2 ** 0)   |   39 ns (*) |    50 ns (+30%)
1 << (2 ** 1)   |   38 ns (*) |    47 ns (+22%)
1 << (2 ** 3)   |   38 ns (*) |    48 ns (+26%)
1 << (2 ** 5)   |   42 ns (*) |    50 ns (+17%)
1 << (2 ** 10)  |   43 ns (*) |    53 ns (+23%)
1 << (2 ** 15)  |  157 ns (*) |   172 ns (+10%)
1 << (2 ** 20)  | 3.91 us (*) |         3.95 us
1 << (2 ** 25)  |  206 us (*) |    218 us (+5%)
1 << (2 ** 28)  | 4.06 ms (*) | 4.29 us (-100%)
123 << 1        |   11 ns (*) |           11 ns
12345678 << 1   |   11 ns (*) |           11 ns
12345678 << 100 |   11 ns (*) |           11 ns
----------------+-------------+----------------
Total           | 4.27 ms (*) |   226 us (-95%)
----------------+-------------+----------------
History
Date User Action Args
2014-05-02 21:10:15vstinnersetrecipients: + vstinner, pitrou, josh.r
2014-05-02 21:10:15vstinnersetmessageid: <1399065015.51.0.725173698422.issue21419@psf.upfronthosting.co.za>
2014-05-02 21:10:15vstinnerlinkissue21419 messages
2014-05-02 21:10:14vstinnercreate