MythicByte opened PR #15202 from MythicByte:issue-15133 to bytecodealliance:main:
replace a custom implementation of a hasher with the same hashbrown uses.
Check
It uses the same libary but a other algorithmen, i think for wasmtime fits this algorithmen better with the deterministic.
Benefit
The new hashing algorithmen is 11 times faster.
Tracking issue: 15133
MythicByte removed the review request for wasmtime-core-reviewers from PR #15202.
MythicByte requested alexcrichton for a review on PR #15202.
MythicByte requested wasmtime-core-reviewers for a review on PR #15202.
MythicByte requested wasmtime-default-reviewers for a review on PR #15202.
MythicByte edited PR #15202:
replace a custom implementation of a hasher with the same hashbrown uses.
Check
It uses the same libary but a other algorithmen, i think for wasmtime fits this algorithmen better with the deterministic.
Benefit
The new hashing algorithmen is 11 times faster.
Tracking issue: #15133
MythicByte edited PR #15202:
replace a custom implementation of a hasher with the same hashbrown uses.
Check
It uses the same libary but a other algorithmen, i think for wasmtime fits the hashing algorithmen better which is deterministic.
Benefit
The new hashing algorithmen is 11 times faster.
Tracking issue: #15133
github-actions[bot] added the label wasmtime:api on PR #15202.
github-actions[bot] added the label wasmtime:ref-types on PR #15202.
github-actions[bot] commented on PR #15202:
Subscribe to Label Action
cc @fitzgen
<details>
This issue or pull request has been labeled: "wasmtime:api", "wasmtime:ref-types"Thus the following users have been cc'd because of the following labels:
- fitzgen: wasmtime:ref-types
To subscribe or unsubscribe from this label, edit the <code>.github/subscribe-to-label.json</code> configuration file.
Learn more.
</details>
:memo: alexcrichton submitted PR review.
:speech_balloon: alexcrichton created PR review comment:
Have you perhaps benchmarked this without specifying any custom hasher here for your workload at all?
Additionally, with a more official hasher, could you explore changing the
u64here to(VMSharedTypeIndex, VMSharedTypeIndex)?
:memo: MythicByte submitted PR review.
:speech_balloon: MythicByte created PR review comment:
I have tried (VMSharedTypeIndex, VMSharedTypeIndex) and it performs a bit worse like _0.1 ns_, i don't now if it for maintenance better this would be your decision. I would say go to default std hashmap to eliminate maintenance burden, the margin efficient increase are not worth it ?
Key Map Hasher Mean u64 hashbrown::HashMap default 2.037 ns u64 hashbrown::HashMap Foldhash FixedState 1.930 ns u64 hashbrown::HashMap std::RandomState 10.815 ns u64 hashbrown::HashMap old NopHasher 118.232 ns u64 std::collections::HashMap default (RandomState) 10.802 ns u64 std::collections::HashMap Foldhash FixedState 1.930 ns u64 std::collections::HashMap old NopHasher 120.446 ns (VMSharedTypeIndex, VMSharedTypeIndex) hashbrown::HashMap default 1.824 ns (VMSharedTypeIndex, VMSharedTypeIndex) hashbrown::HashMap Foldhash FixedState 1.758 ns (VMSharedTypeIndex, VMSharedTypeIndex) hashbrown::HashMap std::RandomState 11.169 ns (VMSharedTypeIndex, VMSharedTypeIndex) std::collections::HashMap default (RandomState) 11.104 ns (VMSharedTypeIndex, VMSharedTypeIndex) std::collections::HashMap Foldhash FixedState 1.766 ns
MythicByte updated PR #15202.
:memo: alexcrichton submitted PR review.
:speech_balloon: alexcrichton created PR review comment:
Thanks for collecting that! For 0.1ns changes that's pretty much noise, so for ergonomics can this PR also switch to the tuple? As for the default-vs-not, I think it'd be reasonable to use
FixedStatehere or the defaultRandomState, up to you.
MythicByte updated PR #15202.
:memo: MythicByte submitted PR review.
:speech_balloon: MythicByte created PR review comment:
tuple switch is complete and the hasher remains with default. I think the performance gain is not worth the extra dependence.
:thumbs_up: alexcrichton submitted PR review.
alexcrichton added PR #15202 wasmtime: replace hasher NopHasher with foldhash Fixedstate to the merge queue.
:check: alexcrichton merged PR #15202.
alexcrichton removed PR #15202 wasmtime: replace hasher NopHasher with foldhash Fixedstate from the merge queue.
fitzgen commented on PR #15202:
This doubled the instructions retired on
hoot-earley-boyerand +61% instructions retired ondart-deltablue: https://github.com/bytecodealliance/wasmtime/issues/15248I think we want to revert this change and investigate another approach.
alexcrichton commented on PR #15202:
posted a revert as https://github.com/bytecodealliance/wasmtime/pull/15251, but @MythicByte please feel free to resubmit after investigating
MythicByte commented on PR #15202:
Thanks @fitzgen for pointing the problem out. The fix is in #15255
Last updated: Nov 19 2026 at 20:05 UTC