diff options
author | Stefan Behnel <stefan_ml@behnel.de> | 2020-05-15 21:16:53 +0200 |
---|---|---|
committer | Stefan Behnel <stefan_ml@behnel.de> | 2020-05-16 10:26:52 +0200 |
commit | fc09a6dcad754d15289041ba2d4a4e4af7191556 (patch) | |
tree | 09e8fe620f251923bf7d1c944a3f77852da50c5d | |
parent | 8bcd2387786f43a1fb5ff00e8e5fff6b36864a91 (diff) | |
download | cython-fc09a6dcad754d15289041ba2d4a4e4af7191556.tar.gz |
Mark the last deletion 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.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Cython/Utility/MemoryView_C.c b/Cython/Utility/MemoryView_C.c index 1b16c8afe..b9b87c437 100644 --- a/Cython/Utility/MemoryView_C.c +++ b/Cython/Utility/MemoryView_C.c @@ -523,7 +523,8 @@ static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW({{memviewslice_name}} *memslice, last_time = __pyx_sub_acquisition_count(memview) == 1; memslice->data = NULL; - if (last_time) { + + if (unlikely(last_time)) { if (have_gil) { Py_CLEAR(memslice->memview); } else { |