On Fri, Mar 18, 2022 at 9:40 AM Paul Bryan <pbr...@anode.ca> wrote: > On Fri, 2022-03-18 at 09:35 -0700, Guido van Rossum wrote: > > The motivation has been explained already. > > > In this thread? >
Yes, Eric's message. > What on earth did your test do that got a speedup by using sets? Was it > repeatedly checking whether a variable was in a slot? The other thing this > does is rearrange the order in which slots appear from run to run (since > set order is affected by hash randomization) and you might have gotten > lucky with a popular attribute being moved to the front, where it's more > likely to be in the memory cache already (cache lines being 64 bytes and > pointers being 8 bytes nowadays). > > > I created objects in a tight loop, populating attributes, noting the > elapsed time. > It does not make sense that that is correlated to the type of __slots__, since __slots__ is not used for instance creation at all (it is only used to create the class). I stick to my likely explanation. Regarding Serhiy's proposal, I'm +0 on disallowing strings, and +0 on disallowing things that can't be reiterated (but it's not a problem in practice). Given other responses the status quo is likely best. -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-change-the-world/>
_______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/EYZ32GBU4QUTRPU26BDCYYMKG4GX633N/ Code of Conduct: http://python.org/psf/codeofconduct/