I had similar issue. Running huge simulations (~15k nodes) in web worker generaly helps.
I was using a WebWorker with a SharedArrayBuffer to do the math for the graph in my app. (Un)fortunately, SharedArrayBuffer has been disabled in response to Spectre.
So, as I was looking for an alternative (except normal ArrayBuffer - memory copying), I figured that SIMD has been dropped in favor of WASM which reached consensus and landed in all relevant browsers.
Are there plans to port to WASM? This project seems like a natural fit for WASM. I found https://github.com/ColinEberhardt/d3-wasm-force which looks like a proof-of-concept to me but has no pulse atm.
In general, which method is advised to optimize performance? 1. Main thread 2. WebWorker with ArrayBuffer (copying) 3. ~~WebWorker with SharedArrayBuffer (non-copying)~~ 4. WASM in the main thread 5. WASM in WebWorker 6. ???
Thanks in advance for the comments.
4条回答 默认 最新
- weixin_39667398 2020-12-05 09:31点赞 评论 复制链接分享
- weixin_39622289 2020-12-05 09:31
I too have had good luck with running large simulations in a separate web worker
I'd also like to explore using
navigator.hardwareConcurrencyto spread the simulation calculations across an appropriate number of child workers (by splitting the nodes list into chunks?), but haven't had time to explore this option yet点赞 评论 复制链接分享
- weixin_39716510 2020-12-05 09:31
SharedArrayBuffer has been re-enabled in Chrome 67 in light of site isolation.点赞 评论 复制链接分享
- weixin_39874881 2020-12-05 09:31
I have no plans to port to WASM, but feel free to fork this library if it helps!点赞 评论 复制链接分享