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 methane
Recipients brandtbucher, christian.heimes, malin, methane, serhiy.storchaka
Date 2022-03-24.07:51:33
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1648108293.56.0.419184788496.issue46864@roundup.psfhosted.org>
In-reply-to
Content
> I guess not much difference in benchmarks.
> But if put a bytes object into multiple dicts/sets, and len(bytes_key) is large, it will take a long time. (1 GiB 0.40 seconds on i5-11500 DDR4-3200)
> The length of bytes can be arbitrary,so computing time may be very different.

I don't think calculating hash() for large bytes is not so common use case.
Rare use cases may not justify adding 8bytes to basic types, especially users expect it is compact.

Balance is important. Microbenchmark for specific case doesn't guarantee the good balance.
So I want real world examples. Do you know some popular libraries that are depending on hash(bytes) performance?


> Is it possible to let code objects use other types? In addition to ob_hash, maybe the extra byte \x00 at the end can be saved.

Of course, it is possible. But it needs large refactoring around code, including pyc cache file format.
I will try it before 3.13.
History
Date User Action Args
2022-03-24 07:51:33methanesetrecipients: + methane, christian.heimes, serhiy.storchaka, malin, brandtbucher
2022-03-24 07:51:33methanesetmessageid: <1648108293.56.0.419184788496.issue46864@roundup.psfhosted.org>
2022-03-24 07:51:33methanelinkissue46864 messages
2022-03-24 07:51:33methanecreate