Re: [pypy-dev] Bringing Cython and PyPy closer together

2012-02-26 Thread Stefan Behnel
Amaury Forgeot d'Arc, 18.02.2012 15:41: > 2012/2/18 Stefan Behnel >> Here's an example. >> >> Python code: >> >> def print_excinfo(): >> print(sys.exc_info()) >> >> Cython code: >> >> from stuff import print_excinfo >> >> try: >> raise TypeError >> except TypeError: >> print_exci

Re: [pypy-dev] Py_DecRef() in cpyext

2012-02-26 Thread Armin Rigo
Hi, On Sun, Feb 26, 2012 at 12:31, Stefan Behnel wrote: > Interesting. Given PyPy's reputation of taking tons of resources to build, > I assume you apply WPA to the sources in order to map them to C? Yes. Please read more about it starting for example from here: http://doc.pypy.org/en/late

Re: [pypy-dev] Py_DecRef() in cpyext

2012-02-26 Thread Stefan Behnel
Hi Armin, Armin Rigo, 26.02.2012 11:09: > On Sun, Feb 26, 2012 at 09:50, Stefan Behnel wrote: >> Looking at Py_DecRef(), however, left me somewhat baffled. I would have >> expected this to be the most intensively tuned function in all of cpyext, >> but it even started with this comment: (...) > >

Re: [pypy-dev] Py_DecRef() in cpyext

2012-02-26 Thread Armin Rigo
Hi Stefan, On Sun, Feb 26, 2012 at 09:50, Stefan Behnel wrote: > Looking at Py_DecRef(), however, left me somewhat baffled. I would have > expected this to be the most intensively tuned function in all of cpyext, > but it even started with this comment: (...) Indeed, it's an obvious starting pla

Re: [pypy-dev] Py_DecRef() in cpyext

2012-02-26 Thread Stefan Behnel
Stefan Behnel, 26.02.2012 09:50: > when I took a look at object.h and saw that the Py_DECREF() macro *always* > calls into it. Another surprise. > > I had understood in previous discussions that the refcount emulation in > cpyext only counts C references, which I consider a suitable design. (I > g

[pypy-dev] Py_DecRef() in cpyext

2012-02-26 Thread Stefan Behnel
Hi, having rewritten Cython's dict iteration to use normal iteration, I ran a little benchmark for comparison and it turned out to be (algorithmically) faster by more than an order of magnitude for a dict with 1000 items. That's pretty decent, although it's still about 100x slower than in CPython.