summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Behnel <stefan_ml@behnel.de>2020-05-15 21:00:16 +0200
committerStefan Behnel <stefan_ml@behnel.de>2020-05-16 10:26:41 +0200
commitcc400539bd85e57fb538e89d1fb223fa88157539 (patch)
tree86985e0544d34119f74834344fbf5476bce00063
parente24d29043d440ec9c6a4d852b406a005dcd78591 (diff)
downloadcython-cc400539bd85e57fb538e89d1fb223fa88157539.tar.gz
Mark the first creation of a memory view slice as "unlikely()" to ask the C compiler to optimise for the repeated re-use case (usually in loops).
-rw-r--r--Cython/Utility/MemoryView_C.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Cython/Utility/MemoryView_C.c b/Cython/Utility/MemoryView_C.c
index 0a52c1eb5..c12918a00 100644
--- a/Cython/Utility/MemoryView_C.c
+++ b/Cython/Utility/MemoryView_C.c
@@ -494,7 +494,7 @@ __Pyx_INC_MEMVIEW({{memviewslice_name}} *memslice, int have_gil, int lineno)
first_time = __pyx_add_acquisition_count(memview) == 0;
- if (first_time) {
+ if (unlikely(first_time)) {
if (have_gil) {
Py_INCREF((PyObject *) memview);
} else {