Dag Sverre Seljebotn wrote: > Stefan Behnel wrote: >> Hi, >> >> Dag Sverre Seljebotn wrote: >>> Stefan Behnel wrote: >>>> What about code like this: >>>> >>>> def test(a): >>>> cdef int c >>>> if a: >>>> c = 1 >>>> if not a: >>>> c = 2 >>>> >>>> How would you know what is a "first assignment" here? And what would you >>>> gain >>>> from your ref-counting optimisation in this case? >>> As for the example, it is a "best-effort" thing. If no assignments are >>> flagged as first, then the optimization just doesn't happen, which is >>> the likely outcome of your example. >> Then what exactly is your "ref-counting optimisation" doing? Can you give me >> a >> code example? > > It makes "cdef int x = 3" behave as before, no more or less. Just > refactoring the code so that buffer worked. I needed to put the stuff > that handled the difference in refcounting somewhere, and that somewhere > leaves a hole in which to plug further improvements, so it was a natural > name, but it doesn't mean that it is more optimized than it used to be. >
Sorry! I meant cdef MyExtensionsType a = x (as int isn't refcounted...). Hmm, I guess that's where the confusion comes from; would tend to make everything I've said unintelligible. -- Dag Sverre _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
