[Cython] None checks for variables of builtin types (rev ffeb158969e)
Stefan Behnel
stefan_ml at behnel.de
Fri Feb 27 09:00:55 CET 2009
Robert Bradshaw wrote:
> I was actually surprised how little of a difference the __builtin_expect
> macros made in most cases, I guess gcc is good at guessing right most of
> the time. (Still worth it I think, as we *know* the common code path.)
I think the problem is that both of us are benchmarking these things on
Intel 32-bit platforms that don't support branch prediction hints and
usually require a certain opcode chain anyway. Plus, these processors are
pretty smart about branch prediction anyway, so running tight loops in
benchmarks will usually result in perfect branch prediction.
There might be a difference on other architectures like Itanium where
compilers are smart and the metal is stupid.
>>> I'd love for someone to implement a control flow analysis--I started to
>>> but never had time to finish (or do it right).
>>
>> The "do it right" can also refer to complexity, BTW. There was a post on
>> c.l.py a couple of months ago where someone presented some heavy
>> algorithm
>> (don't remember what it did) and asked for ways to make it faster. I just
>> went: "ah, I can use Cython for that", but I didn't even manage to
>> compile
>> it. It contained an impressively long list of "if" statements, just one
>> after the other (no nesting), and that let the control flow analysis die
>> from stack exhaustion.
>
> Hmm... did you file a trac ticket?
Ah, you're right, I will.
Stefan
More information about the Cython-dev
mailing list