summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorFredrik Lundh <fredrik@pythonware.com>2006-05-26 11:29:39 (GMT)
committerFredrik Lundh <fredrik@pythonware.com>2006-05-26 11:29:39 (GMT)
commitb8b3c8e276b7f0d2004bc5c7b7ca6d652c0b9327 (patch)
tree7030c2730f3f9d641d2d93c4f0061bf88b8a705b /Include
parenta172c32c05b304c7a346408b2e557cd05f9b8393 (diff)
downloadcpython-b8b3c8e276b7f0d2004bc5c7b7ca6d652c0b9327.zip
cpython-b8b3c8e276b7f0d2004bc5c7b7ca6d652c0b9327.tar.gz
cpython-b8b3c8e276b7f0d2004bc5c7b7ca6d652c0b9327.tar.bz2
needforspeed: added Py_LOCAL macro, based on the LOCAL macro used
for SRE and others. applied Py_LOCAL to relevant portion of ceval, which gives a 1-2% speedup on my machine. ymmv.
Diffstat (limited to 'Include')
-rw-r--r--Include/pyport.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/Include/pyport.h b/Include/pyport.h
index fe79f6d..7d51d0a 100644
--- a/Include/pyport.h
+++ b/Include/pyport.h
@@ -137,6 +137,23 @@ 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. */
+
+#undef USE_INLINE /* XXX - set via configure? */
+
+#if defined(_MSC_VER)
+ /* 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
+#elif defined(USE_INLINE)
+#define Py_LOCAL(type) static inline type
+#else
+#define Py_LOCAL(type) static type
+#endif
+
#include <stdlib.h>
#include <math.h> /* Moved here from the math section, before extern "C" */