[pypy-dev] Scrapy fails in PyPy

Amaury Forgeot d'Arc amauryfa at gmail.com
Fri Dec 14 13:37:02 CET 2012


2012/12/14 Stefan Behnel <stefan_ml at behnel.de>

> Maciej Fijalkowski, 13.12.2012 22:21:
> > On Thu, Dec 13, 2012 at 10:47 PM, Amaury Forgeot d'Arc wrote:
> >> 2012/12/13 Stefan Behnel
> >>>
> >>> My intuition was to add a fastpath to Py_DECREF() that would do (close
> to)
> >>> nothing if the PyPy object is still alive. Either that, or move this
> whole
> >>> decision into C by somehow increasing the C level refcount during the
> >>> lifetime of the PyPy object and decreasing it when the PyPy object
> dies.
> >>
> >> It may be difficult, because most standard types don't have a __del__,
> >> and I'm not sure we can attach a weak reference.
>
> If you can't attach a weakref to an object, that sounds more like a bug to
> me, especially in PyPy.
>

Try this on any Python:
>>> weakref.ref(3)

Supporting weak references is not cheap, especially for short lived objects.
I'm sure you don't want to slow down all strings and numbers that are *not*
passed to extension modules.


> having tons of weakrefs is also a bad idea (or tons of objects with
> __del__s)
>
> So, I take it that it's a tradeoff - not unusual for optimisation. Why not
> just give it a try?



-- 
Amaury Forgeot d'Arc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pypy-dev/attachments/20121214/a4652b99/attachment.html>


More information about the pypy-dev mailing list