Lisandro Dalcin wrote:
> On Sat, Oct 3, 2009 at 5:46 AM, Dag Sverre Seljebotn
> <[email protected]> wrote:
>> In the interest of fixing
>>
>> http://trac.cython.org/cython_trac/ticket/281
>>
> 
> I was thinking on this a couple of days ago. Why the filename is not
> just passed to Pyx_AddTracebak... and further, why the lineno is not
> just stored the C function stack?

Since these are only used in exceptional circumstances, one reason to 
make them globals though might be to help the compiler by making sure 
the variables doesn't occupy registers (because unless the compiler is 
smart enough to take into account the unlikely(), perhaps it will think 
that the except branch will be taken and take a register from some other 
variable that could have better need of it?). Just wildly guessing here 
though.

Actually I blindly assumed it had a reason and should stay that way, 
that's why I started with thread variables. Judging by your responses 
using thread vars isn't the way to go then.

>> I'm doing some benchmarks which are rather surprising to me.
>>
> 
> You should not be surprised, your results are a total nonsense :-)

You sure? As long as i != 0 one would be OK (I only store and retrieve a 
pointer that's opaque to the thread var storage...). Anyway I tried your 
suggestion (which would make the value always != 0) and the timings are 
still the same.

I'm assuming it is nonsense though, even if I can't see why. If not, 
there's a lot of stuff we should better move into thread-local storage :-)

> 
>> Explanations?
> 
> One thing that is suspicious is this line
> 
> PyThread_set_key_value(key, <void*>i)
> 
> I think it should read:
> 
> PyThread_set_key_value(key, <void*>&i)
> 
> go to the actual implementation of that call, you will see
> assert(value != NULL);

-- 
Dag Sverre
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to