diff options
author | Fredrik Lundh <fredrik@pythonware.com> | 2006-05-27 10:39:48 (GMT) |
---|---|---|
committer | Fredrik Lundh <fredrik@pythonware.com> | 2006-05-27 10:39:48 (GMT) |
commit | 7a83089c06744dcdd29eb692dbeb51449191ed3f (patch) | |
tree | d13efa405b4007417cfe6f121ebd23a79a000b74 /Include | |
parent | 2d23d5bf2efcea655b22e0ee4dd7cf6554a94c85 (diff) | |
download | cpython-7a83089c06744dcdd29eb692dbeb51449191ed3f.zip cpython-7a83089c06744dcdd29eb692dbeb51449191ed3f.tar.gz cpython-7a83089c06744dcdd29eb692dbeb51449191ed3f.tar.bz2 |
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.
Diffstat (limited to 'Include')
-rw-r--r-- | Include/pyport.h | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/Include/pyport.h b/Include/pyport.h index 07fdf28..74ce993 100644 --- a/Include/pyport.h +++ b/Include/pyport.h @@ -137,13 +137,17 @@ typedef Py_intptr_t Py_ssize_t; # endif #endif -/* 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 - * inlining, where suitable. +/* Py_LOCAL can be used instead of static to get the fastest possible calling + * convention for functions that are local to a given module. * - * If PY_LOCAL_AGGRESSIVE is defined before python.h is included, a more - * "aggressive" inlining is enabled. This may lead to code bloat, and may - * slow things down for those reasons. Use with care. + * Py_LOCAL_INLINE does the same thing, and also explicitly requests inlining, + * for platforms that support that. + * + * 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 * module; functions that are exported via method tables, callbacks, etc, @@ -160,11 +164,14 @@ typedef Py_intptr_t Py_ssize_t; /* ignore warnings if the compiler decides not to inline a function */ #pragma warning(disable: 4710) /* 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) -#define Py_LOCAL(type) static inline type +#define Py_LOCAL(type) static type +#define Py_LOCAL_INLINE(type) static inline type #else #define Py_LOCAL(type) static type +#define Py_LOCAL_INLINE(type) static type #endif #include <stdlib.h> |