make trace unlikely
authorRobert Bradshaw <robertwb@math.washington.edu>
Tue, 22 Sep 2009 07:05:42 +0000 (00:05 -0700)
committerRobert Bradshaw <robertwb@math.washington.edu>
Tue, 22 Sep 2009 07:05:42 +0000 (00:05 -0700)
Cython/Compiler/Nodes.py

index e1b4524f96f2537fdced27e75d1b4ae6ffe2d4f3..17e63c8965f9c4037aab584d1136c647b2282932 100644 (file)
@@ -5818,12 +5818,12 @@ trace_utility_code = UtilityCode(proto="""
 static PyCodeObject *%(FRAME_CODE)s = NULL;                                        \\
 CYTHON_FRAME_MODIFIER PyFrameObject *%(FRAME)s = NULL;                             \\
 int __Pyx_use_tracing = 0;                                                         \\
-if (PyThreadState_GET()->use_tracing && PyThreadState_GET()->c_profilefunc) {      \\
+if (unlikely(PyThreadState_GET()->use_tracing && PyThreadState_GET()->c_profilefunc)) {      \\
     __Pyx_use_tracing = __Pyx_TraceSetupAndCall(&%(FRAME_CODE)s, &%(FRAME)s, funcname, srcfile, firstlineno);  \\
 }
 
 #define __Pyx_TraceException()                                                           \\
-if (__Pyx_use_tracing && PyThreadState_GET()->use_tracing && PyThreadState_GET()->c_profilefunc) {  \\
+if (unlikely(__Pyx_use_tracing( && PyThreadState_GET()->use_tracing && PyThreadState_GET()->c_profilefunc) {  \\
     PyObject *exc_info = __Pyx_GetExceptionTuple();                                      \\
     if (exc_info) {                                                                      \\
         PyThreadState_GET()->c_profilefunc(                                              \\
@@ -5833,7 +5833,7 @@ if (__Pyx_use_tracing && PyThreadState_GET()->use_tracing && PyThreadState_GET()
 }
 
 #define __Pyx_TraceReturn(result)                                                  \\
-if (__Pyx_use_tracing && PyThreadState_GET()->use_tracing && PyThreadState_GET()->c_profilefunc) {  \\
+if (unlikely(__Pyx_use_tracing) && PyThreadState_GET()->use_tracing && PyThreadState_GET()->c_profilefunc) {  \\
     PyThreadState_GET()->c_profilefunc(                                            \\
         PyThreadState_GET()->c_profileobj, %(FRAME)s, PyTrace_RETURN, (PyObject*)result);     \\
     CYTHON_FRAME_DEL;                                                               \\