On Thu, 12 Mar 2020 at 17:42, Eric Wieser <wieser.eric+nu...@gmail.com> wrote:
> As an example of these optimizations being valuable, see 
> https://github.com/numpy/numpy/pull/7997, which claims the optimization I 
> described at the beginning resulted in a 1.5x-2x speedup.

This speedup is observed only for large objects. I quote:

> Heuristicly it seems to be beneficial around 400kb array sizes (which is 
> about the typical L2 cache size).

I think anyway that this could be a good idea, without changing `del`.
The problem is: how can Python knows that a generic operation will
create a temporary variable? The change you linked was done
specifically for ndarrays, that you know they are immutable. How can
Python know that an object is an immutable?
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/JCDYIXBNA7V2W7CZNUWOEJZFQSEG3BQ2/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to