The best way of getting the context would be searching for disposal_code in the
source until you find such a case.
My situation is that I don't know how that code got there or who wrote it, I
just have to adapt to it when moving the temps to code generation, preferably
while making as few other changes at the same time as possible.
I can guess though .. take BoolBinopNode as an example.
def f(): return []
def g(n):
if n == 0: return 5
else: return f() or g(n-1)
print g(100000000)
Since the "or" can decref the result of f() inside the if-branch evaluating
g(..), memory usage for the code in Cython is O(1) rather than O(n). (Not
saying that it is not O(1) in Pyrex, I wouldn't know).
I'm not 100 percent sure about this but it is what I figure.
Dag Sverre Seljebotn
-----Original Message-----
From: Greg Ewing <[EMAIL PROTECTED]>
Date: Tuesday, Dec 2, 2008 12:03 am
Subject: Re: [Cython] Temp allocation flow
To: [EMAIL PROTECTED]: [email protected]
Dag Sverre Seljebotn wrote:
>
>> I don't know Pyrex that well, and weren't around at the time of the fork.
> I assume it is Cython-only then.
>
>Maybe you could provide a bit more context still? I'm just
>wondering why you can't generate the disposal code after
>the whole if-statement, rather than duplicating it in each
>branch.
>
>--
>Greg
>_______________________________________________
>Cython-dev mailing list
>[email protected]
>http://codespeak.net/mailman/listinfo/cython-dev
>
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev