4 ms·
WebWorkers are not very useful as a result. The communication overhead of copying data between two memory spaces usually dwafs any apeedups you could get from d
by admax88qqq 4y ago
WebWorkers are not very useful as a result. The communication overhead of copying data between two memory spaces usually dwafs any apeedups you could get from doing the work in parallel.
It's easier to implement as a language and runtime, but to get truly high performance on today's many thread many core machines you need shar d memory concurrency more like Java
- CJefferson 4y agoTrue, they are of limited usefulness, but in Emacs you could (probably) make them more useful over time by exposing more and more sharing -- but (I'm again guessing, don't know Emac's insides) it might be easier/safer to start sharing nothing, then work on sharing as much as possible, rather than start with full sharing and then try to make everything work.
- jlokier 4y ago> to get truly high performance on today's many thread many core machines you need shared memory concurrency more like Java JavaScript supports shared memory concurrency. Shared memory¹ is available in browser WebWorkers these days.² Atomic ops for building multi-threaded data structures³ are available too⁴. Including primitives for thread synchronisation⁵⁶ used by mutexes, condvars, producer-consumer queues, etc. ¹ https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe... ² https://caniuse.com/sharedarraybuffer https://caniuse.com/sharedarraybuffer ³ https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe... ⁴ https://caniuse.com/mdn-javascript_builtins_atomics https://caniuse.com/mdn-javascript_builtins_atomics ⁵ https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics/wait https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe... ⁶ https://caniuse.com/mdn-javascript_builtins_atomics_wait https://caniuse.com/mdn-javascript_builtins_atomics_wait
- hinkley 4y agoArrays of bytes are practically useless in Javascript. And the message passing system for NodeJS workers is almost as useless because it's just as alien to the rest of the javascript normal people write as shared byte arrays is. What we needed was message passing implemented as an async operation that awaited a response. Bidirectional emit() operations don't scale. If you were building something on top of them using wasm then you probably wouldn't even know what the primitive was. But we're not. We're writing Javascript, and it's a damned shame. When someone takes a really long time to make a really bad solution, there's frequently not enough group will to correct the issue. This will be the bullshit we are stuck with for the next ten years.