Commit a50be2a1 authored by Stefan Behnel's avatar Stefan Behnel

Also mark the case of an uninitialised memory view slice as "unlikely()" when...

Also mark the case of an uninitialised memory view slice as "unlikely()" when refcounting it since it's most probably not a performance critical case.
parent fc09a6dc
...@@ -485,7 +485,7 @@ __Pyx_INC_MEMVIEW({{memviewslice_name}} *memslice, int have_gil, int lineno) ...@@ -485,7 +485,7 @@ __Pyx_INC_MEMVIEW({{memviewslice_name}} *memslice, int have_gil, int lineno)
{ {
int first_time; int first_time;
struct {{memview_struct_name}} *memview = memslice->memview; struct {{memview_struct_name}} *memview = memslice->memview;
if (!memview || (PyObject *) memview == Py_None) if (unlikely(!memview || (PyObject *) memview == Py_None))
return; /* allow uninitialized memoryview assignment */ return; /* allow uninitialized memoryview assignment */
if (unlikely(__pyx_get_slice_count(memview) < 0)) if (unlikely(__pyx_get_slice_count(memview) < 0))
...@@ -510,9 +510,8 @@ static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW({{memviewslice_name}} *memslice, ...@@ -510,9 +510,8 @@ static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW({{memviewslice_name}} *memslice,
int last_time; int last_time;
struct {{memview_struct_name}} *memview = memslice->memview; struct {{memview_struct_name}} *memview = memslice->memview;
if (!memview ) { if (unlikely(!memview || (PyObject *) memview == Py_None)) {
return; // we do not ref-count None
} else if ((PyObject *) memview == Py_None) {
memslice->memview = NULL; memslice->memview = NULL;
return; return;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment