Kaydet (Commit) 7a83089c authored tarafından Fredrik Lundh's avatar Fredrik Lundh

needforspeed: backed out the Py_LOCAL-isation of ceval; the massive in-

lining killed performance on certain Intel boxes, and the "aggressive"
macro itself gives most of the benefits on others.
üst 2d23d5bf
...@@ -137,13 +137,17 @@ typedef Py_intptr_t Py_ssize_t; ...@@ -137,13 +137,17 @@ typedef Py_intptr_t Py_ssize_t;
# endif # endif
#endif #endif
/* PY_LOCAL can be used instead of static to get the fastest possible calling /* Py_LOCAL can be used instead of static to get the fastest possible calling
* convention for functions that are local to a given module. It also enables * convention for functions that are local to a given module.
* inlining, where suitable.
* *
* If PY_LOCAL_AGGRESSIVE is defined before python.h is included, a more * Py_LOCAL_INLINE does the same thing, and also explicitly requests inlining,
* "aggressive" inlining is enabled. This may lead to code bloat, and may * for platforms that support that.
* slow things down for those reasons. Use with care. *
* If PY_LOCAL_AGGRESSIVE is defined before python.h is included, more
* "aggressive" inlining/optimizaion is enabled for the entire module. This
* may lead to code bloat, and may slow things down for those reasons. It may
* also lead to errors, if the code relies on pointer aliasing. Use with
* care.
* *
* NOTE: You can only use this for functions that are entirely local to a * NOTE: You can only use this for functions that are entirely local to a
* module; functions that are exported via method tables, callbacks, etc, * module; functions that are exported via method tables, callbacks, etc,
...@@ -160,11 +164,14 @@ typedef Py_intptr_t Py_ssize_t; ...@@ -160,11 +164,14 @@ typedef Py_intptr_t Py_ssize_t;
/* ignore warnings if the compiler decides not to inline a function */ /* ignore warnings if the compiler decides not to inline a function */
#pragma warning(disable: 4710) #pragma warning(disable: 4710)
/* fastest possible local call under MSVC */ /* fastest possible local call under MSVC */
#define Py_LOCAL(type) static __inline type __fastcall #define Py_LOCAL(type) static type __fastcall
#define Py_LOCAL_INLINE(type) static __inline type __fastcall
#elif defined(USE_INLINE) #elif defined(USE_INLINE)
#define Py_LOCAL(type) static inline type #define Py_LOCAL(type) static type
#define Py_LOCAL_INLINE(type) static inline type
#else #else
#define Py_LOCAL(type) static type #define Py_LOCAL(type) static type
#define Py_LOCAL_INLINE(type) static type
#endif #endif
#include <stdlib.h> #include <stdlib.h>
......
This diff is collapsed.
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