Closed ghost closed 2 years ago
Hey @mockfox what are you trying to achieve using this crate inside of wasm? Most of the value here is in multi-threaded contexts, so I'm wondering if you just are after the concurrently readable cell types, or if you really want all the hashtrie/hashmap functionality. That'll help me know what the right thing to do is to fix this.
At the moment, I am using HashMap although the other concurrent types would also be useful in other projects. I am using it in a multithreaded context (wasm_bindgen_futures).
So I think the best option in this case is:
That should let you use this with wasm, provided you set --default-features=false.
How does that sound?
EDIT: I'm skeptical to change default hashers by default by ahash is the 'fastest' hasher on other platforms, and in the review wyhash is not dos resistant https://github.com/tkaitchuck/aHash/blob/master/compare/readme.md
It does make sense to use the std hasher when the ahash feature is disabled, just to get the crate to compile to wasm on its own with a DOS resistant hash by default. I think that suggesting wyhash perhaps should have been a separate issue; I typically do not need DOS resistant hashes. It would be nice to be able to enable an alternative like wyhash as a feature.
Done! Please upgrade to 0.3.4, and you'll find all the features there. Should also be documented on docs.rs.
This crate does not compile to wasm as-is due to a dependency on
ahash
or rather its dependencygetrandom
. It is relatively easy to get it to compile by pinning thegetrandom
dependency with thejs
feature. It would be nice to not need to do this, ie. this crate could support a different hash algorithms likewyhash
which only depends onrand-core
and compiles to wasm without issue.