-
Notifications
You must be signed in to change notification settings - Fork 44
Open
Description
Use web_worker
to create a new rayon::ThreadPool
to enable parallelization on wasm
.
The wasm
app will need a initialization for the global ThreadPool, so probably something like this:
fn set_global_pool_to_web_workers() {
let concurrency = match web_sys::window() {
Some(window) => window.navigator().hardware_concurrency() as usize,
None => {
console_log!("Failed to get hardware concurrency from window. This function is only available in the main browser thread.");
2
}
};
let worker_pool = pool::WorkerPool::new(concurrency);
rayon::ThreadPoolBuilder::new()
.num_threads(concurrency)
.spawn_handler(|thread| Ok(pool.run(|| thread.run()).unwrap()))
.build()?;
}
cc @kobigurk @howardwu, this is of interest for speeding up proving and setup ceremonies in the browser.
kobigurk, ValarDragon and micahscopesburdges
Metadata
Metadata
Assignees
Labels
No labels