The Path to Parallel JavaScript
51–58 of 58 posts
Re: The Path to Parallel JavaScript
#52Re: The Path to Parallel JavaScript
#53While message passing might make sense for some tasks, it's not going to be quick enough to do things in 16ms and achieve the magical 60fps. Eventually shared memory is going to be needed, and if we get that far I think there will have to be some sort of acknowledgement that these performance-related features can't possibly be foolproof.
Oh, and an asynchronous thread safe DOM, please and thanks :)
Re: The Path to Parallel JavaScript
#54Great developments, since, imho, we really need multi-threading to make decent user-interfaces (ones without hick-ups due to blocking of the cpu-resource). I think what we need is immutable data-structures to be shareable between threads. This approach should also allow structural sharing between threads, allowing for efficient and safe data structures. Also, I could see a use for a mechanism where a thread creates a…
The proposal only is for sharing memory in between Worker threads, which can't access the DOM (which also means canvas, WebGL, etc aren't able to be accessed). It doesn't do anything to help make UIs smoother: you still have to copy to transfer data from the UI thread to the Worker threads and back. If that isn't a problem, then Workers as-is will unblock your UI: you can already do this with Workers as they're imple…
Re: The Path to Parallel JavaScript
#55Earlier quoted context omitted.
How does it make it difficult?
You can only call async functions inside async functions. See also What color is your function? http://journal.stuffwithstuff.com/2015/02/01/what-color-is-y...
In real-world scenarios though, most of the time you'll be reacting to events, and not calling async code from sync code.
Edit: To clarify I'm talking about the ES7 async/await feature.
Re: The Path to Parallel JavaScript
#56Earlier quoted context omitted.
How does it make it difficult?
I have encounter this problem https://stackoverflow.com/questions/28708238/catching-except... Basically, it's hard and prone to bugs.
Re: The Path to Parallel JavaScript
#57 sharedObject.lock(^() => {
/* use object, which is locked until async promise resolves/rejects */
});
where `^` is a short key for an async lambda function... `async` keyword could be used too... just throwing the `^` out there.This could lock the object, allowing for an async function to execute... when the async function promise resolves, the lock is released... it would have to be limited to async functions though. but that would likely hit the JS engines around the same time as any shared objects anyway.
Re: The Path to Parallel JavaScript
#58I've been thinking that something combined with the use of async functions (es7) could be used for Shared* locking... sharedObject.lock(^() => { /* use object, which is locked until async promise resolves/rejects */ }); where `^` is a short key for an async lambda function... `async` keyword could be used too... just throwing the `^` out there. This could lock the object, allowing for an async function to execute...…
It also makes isomorphic interfaces (async node & browser) slightly harder.