[pypy-dev] Safety of replacing the instance dict

Tin Tvrtković tinchester at gmail.com
Mon Jan 29 10:27:51 EST 2018


Thanks a lot, Armin. If we go this way, it's easy to special case PyPy.

On Mon, Jan 29, 2018 at 2:42 PM Armin Rigo <armin.rigo at gmail.com> wrote:

> Hi,
>
> On 29 January 2018 at 11:22, Tin Tvrtković <tinchester at gmail.com> wrote:
> > It's just that doing it this way is unconventional and a little scary.
> Would
> > we be violating a Python rule somewhere and making stuff blow up later
> if we
> > went this way?
>
> No, it's semantically fine.  But it comes with a heavy penalty on
> PyPy.  I guess you don't see it because you measured something tiny,
> like creating the instance and then throwing it away---the JIT
> optimizes that to nothing at all in both cases.  Not only is the
> creation time larger, but attribute access is slower, and the memory
> usage is larger.
>
>
> A bientôt,
>
> Armin.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pypy-dev/attachments/20180129/f398e41b/attachment.html>


More information about the pypy-dev mailing list