Conversation
|
Most of my Rust experience so far has been for the WASM compilation target, AKA browser, where multithreading support is very limited. For that reason, I've never used Rayon and can't really advise on how to best integrate it, but it would be amazing to have for wider adoption of the library. This PR makes it look promising and trivial. The only opinion I can offer is that we can hide the Rayon dependency behind a feature flag. For most browser use cases it can't be used anyway and so just bloats the web page download size. If Rayon has something like a "single thread only" mode that adds a negligible amount of data to the build size, that might be a better option for cleaner code to avoid having separate Rayon/non-Rayon codepaths. I would also like to understand how close Rayon is to a drop in replacement for C++'s Thread Building Blocks. My fear is that Rust's exclusive mutability rule may make a lot of Manifold's optimizations infeasible to port. |
Was thinking about this because spheres were taking a while to generate in the test suite.
As of now I don't have numbers to compare speeds with, and I also haven't added the "autoPolicy" thing yet.
This is not adding it to everything, but just in a few places that were easy enough to do.