An adapter for enabling Rayon-based concurrency on the Web with WebAssembly.
I am using rayon::scope and rayon::spawn in my wasm library with #[wasm_bindgen], I use `wasm-pack build --target web` to compile and my code structure is: ``` rayon::scope(|s| { s.spawn(move |_| { //thread }); s.spawn(move |_| { //thread }); s.spawn(move |_| { //thread }); }); ``` I have used following js code to initialize number of threads through worker.js: ``` import init, {benchmarkFunction, initThreadPool} from "./pkg/wasm.js"; init().then(_ => { initThreadPool(navigator.hardwareConcurrency).then(async _ => { console.time("benchmarkFunction") await benchmarkFunction(); console.timeEnd("benchmarkFunction") }) }) ``` I am using M2 machine with 10 cores and I have tried entering cores manually as well. It compiles and loads, I can see multiple workerHelpers.js loading in the network tab along with my main wasm.js repeatedly. Seems like cores are being used but the end result is same benchmark time if I run it using single thread or multi-threards or don't use `wasm-bindgen-rayon` at all. Also from the source I could not understand if this adapter is written for all kinds of rayon threads like the ones I am using above or is it for specific use-cases. I will be grateful for any pointers.
This issue appears to be discussing a feature request or bug report related to the repository. Based on the content, it seems to be resolved. The issue was opened by hammadtq and has received 2 comments.