[Python-checkins] r46291 - in python/trunk: Include/pyport.h Python/ceval.c

Jim Jewett jimjjewett at gmail.com
Fri May 26 20:32:48 CEST 2006


Could you add some comments on testing for USE_INLINE right after
undefining it?

I'm assuming that the #undef either fails, or unmasks a higher-scope
definition, but I don't have much confidence in that assumption.

-jJ

On 5/26/06, fredrik.lundh <python-checkins at python.org> wrote:
> Author: fredrik.lundh
> Date: Fri May 26 13:29:39 2006
> New Revision: 46291
>
> Modified:
>    python/trunk/Include/pyport.h
>    python/trunk/Python/ceval.c
> Log:
> 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.
>
>
>
> Modified: python/trunk/Include/pyport.h
> ==============================================================================
> --- python/trunk/Include/pyport.h       (original)
> +++ python/trunk/Include/pyport.h       Fri May 26 13:29:39 2006
> @@ -137,6 +137,23 @@
>  #   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
> +


More information about the Python-checkins mailing list