Hacker News new | past | comments | ask | show | jobs | submit login

Since it’s something I’ve been paying attention to for a while: this (beta, sure, but soon to be full. Probably would work fine for doing some dev work) release of Electron finally bundles the version of Chrome that implemented SharedArrayBuffer support. This means that developers can now spawn web workers (real parallelism) and communicate with them much faster than previously with message passing. So there could be some big wins for things like developing games in Electron since you’ll be able to do some big number crunching off the UI “thread” and hand the results back to the UI with little performance penalty. (Especially if there are a lot of results, such as a theoretical fully-updated scene graph worth of matrices in an array) Hooray for less jank on the renderer!



Notably, `SharedArrayBuffer` was disabled (starting Jan 5 2018) due to Spectre.

Nevertheless, it is going to be re-enabled so it is worth reading up on shared memory in JavaScript -- more to the point, Atomics.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...

I know a lot of people scoff at the Node/browser runtimes, which is warranted and totally unrelated to the language known as JavaScript, but performance is improving.


Is it disabled in the version of Chrome shipping with Electron? Considering they’re usually some number of versions behind, and this is a tool to make a desktop app, it would seem to be desirable to have it enabled regardless of Spectre since a desktop app can own your computer anyway if it wants. (It does make sense to have it disabled in a general purpose browser until mitigation’s are in place)


You can already experiment with SAB in electron 1.7.9 with flags.


Since I'm not seeing an obvious flag from a quick search (it seems like you need to do something with a harmony flag?), could you put the exact flag necessary to enable SharedArrayBuffers in 1.7.9? Preferably in the format that would be used to commonly run Electron. (I think you usually use npm to start the Electron process? Been a while since I did something with Electron since I've been waiting for the SAB feature to land)

EDIT: Found that the correct flag is "--harmony-sharedarraybuffer". If directly running electron, then you would use "electron --js-flags="--harmony-sharedarraybuffer" index.html" (or "." instead of "index.html"). If using the electron quick start repository, you can add the flag above to package.json.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: