Closed zxch3n closed 2 years ago
Actually, given that this is purely invoking JS APIs, let's move this check to startWorkers
in https://github.com/GoogleChromeLabs/wasm-bindgen-rayon/blob/main/src/workerHelpers.js and https://github.com/GoogleChromeLabs/wasm-bindgen-rayon/blob/main/src/workerHelpers.no-bundler.js instead.
That will be a bit cheaper, because it won't require few extra roundtrips to JS, and, correspondingly, will also produce slightly smaller output.
Done. And make it throw if one uses a negative thread number.
I'd prefer to keep things as simple as possible.
I can see why someone might make a mistake of passing 0
, but passing a negative number seems less likely. Can you please revert to the same check & message you had in Rust code, but move it to JS?
done
Thanks!
Related issue: #20