Author stutzbach
Recipients amaury.forgeotdarc, collinwinter, eric.smith, mark.dickinson, pitrou, rhettinger, stutzbach, terry.reedy, tim.peters
Date 2010-12-01.23:42:11
SpamBayes Score 0.0
Marked as misclassified No
Message-id <>
> The use of  Py_LOCAL_INLINE is new to me since we usually use #define
> instead, but this has a cleaner look to it.  I am unclear on whether
> all the our target compilers support an inline keyword.   If you're
> sure it works everywhere, that's great.

I fixed ./configure to properly set up Py_LOCAL_INLINE in Issue5553. :-)

It will expand to "static inline" under both MSVC and gcc.  On older compilers, it may expand to "static __inline__", "static __inline", or whatever else is needed to get the job done.  

As a last resort, it will expand to simply "static", but I don't know of any 32-bit (or 64-bit) compilers where that would actually happen.

> Also note that this patch puts a lot of faith in branch prediction.
> If some target processor doesn't support it, or has limited ability
> to remember predictions, or mispredicts, then the code will be slower.

I think even a limited amount of memory dedicated to branch prediction should be sufficient.  There are two cases:

1) Sorting a simple type, like an int: the comparison is lightweight, and the CPU should have plenty of memory to remember which branch to take in the sorting code.

2) Sorting a complex type (i.e., calling a __lt__ method written in Python): the processor might not be able to remember which branch to take, but the performance impact will be small (as a percentage) since most of the CPU is being consumed by the comparisons.

Thanks for taking the time to review this.
Date User Action Args
2010-12-01 23:42:12stutzbachsetrecipients: + stutzbach, tim.peters, collinwinter, rhettinger, terry.reedy, amaury.forgeotdarc, mark.dickinson, pitrou, eric.smith
2010-12-01 23:42:12stutzbachsetmessageid: <>
2010-12-01 23:42:11stutzbachlinkissue9915 messages
2010-12-01 23:42:11stutzbachcreate