[issue25414] Drop unnecessary size limit test from deques on builds with 64-bit numbers
Raymond Hettinger
report at bugs.python.org
Thu Oct 15 11:36:16 EDT 2015
New submission from Raymond Hettinger:
The following test can never succeed when PY_SSIZE_T_MAX is 63-bits (as that number of allocations would exceed possible time and memory).
#define MAX_DEQUE_LEN (PY_SSIZE_T_MAX - 3*BLOCKLEN)
if (len >= MAX_DEQUE_LEN) {
PyErr_SetString(PyExc_OverflowError,
"cannot add more blocks to the deque");
return NULL;
}
Removing the test saves a recurring block of code through-out the module. The block adds register pressure, triggers an unnecessary memory access and has a predictable test-and-jump.
Conditional compilation can leave the test in for builds with size_t under 64-bits.
----------
messages: 253053
nosy: rhettinger
priority: normal
severity: normal
status: open
title: Drop unnecessary size limit test from deques on builds with 64-bit numbers
versions: Python 3.6
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue25414>
_______________________________________
More information about the Python-bugs-list
mailing list