[whatwg] Web Workers

Boris Zbarsky bzbarsky at MIT.EDU
Wed Jul 21 13:55:36 PDT 2010


On 7/21/10 4:11 PM, Ryan Heise wrote:

 > Note that things might have been different had Javascript been a
 > purely functional language. If this were the case, then there would
 > be much safer and more efficient alternatives to making whole copies
 > of data that could be implemented under the hood.

Why does this require JS to be purely functional?  There's already work 
happening in this direction, though obviously arbitrary object graphs 
are hard due to the mutability.

If we eliminate mutability (e.g. sealing the objects in the relevant 
graph), then the memory could in fact be shared instead of copied, right?

> For all of the reasons above, I would like to see something like threads
> in Javascript.

Note that some current JS engines support this (though not in a web 
context at the moment).

Note also that said engines are removing said support for various 
reasons (performance penalties are a large part of it).

> Is not allowing deadlocks important enough that we should make
> it impossible for a certain class of algorithms to exploit multi-core
> CPUs?

Possibly, yes.

> As a final thought, I would like to say that it is actually possible to
> detect deadlock conditions at runtime and immediately throw an exception
> rather than simply hang the web browser.

At what performance cost in the typical case, though?

-Boris



More information about the whatwg mailing list