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 <[email protected]>
<http://bugs.python.org/issue25414>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com