bpo-46845: Reduce dict size when all keys are Unicode (GH-31564)

This commit is contained in:
Inada Naoki 2022-03-02 08:09:28 +09:00 committed by GitHub
parent 21099fc064
commit 9833bb91e4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 884 additions and 491 deletions

View file

@ -404,6 +404,11 @@ Optimizations
larger *k*).
(Contributed by Serhiy Storchaka in :issue:`37295`.)
* Dict don't store hash value when all inserted keys are Unicode objects.
This reduces dict size. For example, ``sys.getsizeof(dict.fromkeys("abcdefg"))``
becomes 272 bytes from 352 bytes on 64bit platform.
(Contributed by Inada Naoki in :issue:`46845`.)
CPython bytecode changes
========================