STINNER Victor added the comment: > 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%) ----------------+-------------+---------------- ---------- Added file: http://bugs.python.org/file35137/long_lshift2.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue21419> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com