[issue46864] Deprecate ob_shash in BytesObject

Ma Lin report at bugs.python.org
Wed Mar 23 07:50:49 EDT 2022


Ma Lin <malincns at 163.com> added the comment:

If put a bytes object into multiple dicts/sets, the hash need to be computed multiple times. This seems a common usage.

bytes is a very basic type, users may use it in various ways. And unskilled users may checking the same bytes object against dicts/sets many times.

FYI, 1 GiB data:

function         seconds
hash()           0.40
binascii.crc32() 1.66   (Gregory P. Smith is trying to improve this)
zlib.crc32()     0.65

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46864>
_______________________________________


More information about the Python-bugs-list mailing list