summaryrefslogtreecommitdiffstats
path: root/Include/listobject.h
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2015-05-22 07:41:57 (GMT)
committerRaymond Hettinger <python@rcn.com>2015-05-22 07:41:57 (GMT)
commit5cbd8331ff567ee568713dc5e63820ffb453ac4b (patch)
treec1b75bc79b07dead4ee4ec38c06c7596be5c8233 /Include/listobject.h
parent35e24a50c569a822c3379ba05714d9bffa3550e5 (diff)
downloadcpython-5cbd8331ff567ee568713dc5e63820ffb453ac4b.zip
cpython-5cbd8331ff567ee568713dc5e63820ffb453ac4b.tar.gz
cpython-5cbd8331ff567ee568713dc5e63820ffb453ac4b.tar.bz2
Issue #24221: Small optimizations for heapq.
Replaces the PyList_GET_ITEM and PyList_SET_ITEM macros with normal array accesses. Replace the siftup unpredicatable branch with arithmetic. Replace the rc == -1 tests with rc < 0. Gives nicer looking assembly with both Clang and GCC-4.9. Also gives a small performance both for both.
Diffstat (limited to 'Include/listobject.h')
-rw-r--r--Include/listobject.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/Include/listobject.h b/Include/listobject.h
index 74cf46f..daa513f 100644
--- a/Include/listobject.h
+++ b/Include/listobject.h
@@ -72,6 +72,7 @@ PyAPI_FUNC(void) _PyList_DebugMallocStats(FILE *out);
#define PyList_GET_ITEM(op, i) (((PyListObject *)(op))->ob_item[i])
#define PyList_SET_ITEM(op, i, v) (((PyListObject *)(op))->ob_item[i] = (v))
#define PyList_GET_SIZE(op) Py_SIZE(op)
+#define _PyList_ITEMS(op) (((PyListObject *)(op))->ob_item)
#endif
#ifdef __cplusplus