|
|
|
|
|
by azakai
4128 days ago
|
|
The blog post does mention the main thread, as something that is more complex and in need of further investigation. Still, even without shared memory being accessible to the main thread, I think sharing between workers can be extremely useful. Yes, you need to proxy information to the main thread in order to render, but that doesn't need to be a big problem. See for example the test here, where a 3D game's rendering was proxied to the main thread, with little loss of performance, https://blog.mozilla.org/research/2014/07/22/webgl-in-web-wo... That very small overhead could be worth letting the game run in multiple workers while using shared memory. Also, things like Canvas 2D and WebGL are APIs that might exist in workers, there are efforts towards that happening right now. That would eliminate the need to copy anything to the main thread, and avoid a lot of latency. |
|
Regardless, shared memory isn't only useful for WebGL. It's useful for any kind of UI where you don't want to block the main thread, and if you don't have DOM access it's tough to make that work. If copying is fine then current Workers are good enough; if copying isn't fine, then this doesn't change that.