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

Just use Workers API and spawn another JavaScript thread



Well then you’re back to the bridge problem. postMessage is crazy slow. There are some problems where parallelization will outperform the ipc cost with postMessage but those problems are few and far between. I haven’t dove into the new web GPU api but it does look kinda promising (shared memory is hard, so I’m apprehensive). I’m sure some of these things will get solved in the long run but for the time being, the bottleneck to browser performance is not necessarily JavaScript itself but the webapis that are crafted around a single threaded model. This is really my only point. Aside from providing systems engineers familiarity with syntax/devex and possibly some portability with some llvm/wasm compatible libs, there is little point in wasm runtimes at this current time imo.

citation:

https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers...

“Data is sent between workers and the main thread via a system of messages — both sides send their messages using the postMessage() method, and respond to messages via the onmessage event handler (the message is contained within the message event's data attribute). The data is copied rather than shared.”


Transferable objects have been part of the spec for a while now, making it possible to send data back and forth contexts with no copying.

https://developer.chrome.com/blog/transferable-objects-light...




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

Search: