This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author christian.heimes
Recipients Mark.Shannon, christian.heimes, erlendaasland, gvanrossum, lemburg, methane, rhettinger, serhiy.storchaka, vstinner
Date 2021-10-09.16:31:49
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1633797109.69.0.406468164018.issue29410@roundup.psfhosted.org>
In-reply-to
Content
> But do they use them as dict keys? AFAIK strings aren't hashed until hash() is called on them.

That's correct. The hash of str and bytes is calculated on demand and then cached.

Frozensets also cache their hash values while tuples don't have a cache. We ran experiments with hash caching in tuples many years ago. It turned out that the increased size had an overall negative effect on performance. This may have changed with modern hardware with more RAM and much larger CPU caches, though.
History
Date User Action Args
2021-10-09 16:31:49christian.heimessetrecipients: + christian.heimes, lemburg, gvanrossum, rhettinger, vstinner, methane, Mark.Shannon, serhiy.storchaka, erlendaasland
2021-10-09 16:31:49christian.heimessetmessageid: <1633797109.69.0.406468164018.issue29410@roundup.psfhosted.org>
2021-10-09 16:31:49christian.heimeslinkissue29410 messages
2021-10-09 16:31:49christian.heimescreate