On Fri, Aug 11, 2017 at 10:17 PM, Guido van Rossum <gu...@python.org> wrote:
> I may have missed this (I've just skimmed the doc), but what's the rationale
> for making the EC an *immutable* mapping? It's impressive that you managed
> to create a faster immutable dict, but why does the use case need one?

In this proposal, you have lots and lots of semantically distinct ECs.
Potentially every stack frame has its own (at least in async code). So
instead of copying the EC every time they create a new one, they want
to copy it when it's written to. This is a win if writes are
relatively rare compared to the creation of ECs.

You could probably optimize it a bit more by checking the refcnt
before writing, and skipping the copy if it's exactly 1. But even
simpler is to just always copy and throw away the old version.


Nathaniel J. Smith -- https://vorpus.org
Python-ideas mailing list
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to