10

Avoid sorting in hash map stable hashing by Kobzol · Pull Request #91837 · rust-...

 2 years ago
source link: https://github.com/rust-lang/rust/pull/91837
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Copy link

Contributor

Kobzol commented on Dec 12, 2021

Suggested by @the8472 here. I hope that I understood it right, I replaced the sort with modular multiplication, which should be commutative.

Can I ask for a perf. run? However, locally it didn't help at all. Creating the StableHasher all over again is probably slowing it down quite a lot. And using FxHasher is not straightforward, because the keys and values only implement HashStable (and probably they shouldn't be just hashed via Hash anyway for it to actually be stable).

Maybe the StableHash interface could be changed somehow to better suppor these scenarios where the hasher is short-lived. Or the StableHasher implementation could have variants with e.g. a shorter buffer for these scenarios.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK