3 ms·
> I'm hoping eventually all the browsers will have something low level and fast enough to realistically do this kind of thing (e.x. Native Client) I don't thin
by azakai 15y ago
> I'm hoping eventually all the browsers will have something low level and fast enough to realistically do this kind of thing (e.x. Native Client)
I don't think Native Client is the solution. For technical reasons, the sandboxing mechanism there has a big cost to entering and leaving the sandbox. The worst case for that is something like a codec, where you constantly stream information in and out. NaCl works better when you have lots of computation and very little input/output.
(That might be fixable in theory, but just as fixable is the speed of JavaScript.)
- ryanpetrich 15y agoThe cost is per transition and transferring a single native array per frame should be cheap. There is no reason a NaCl decoder couldn't limit itself to one write per frame and a single read when more data comes in.
- azakai 15y agoOne write per frame would potentially be not so bad, that's true. I wonder though if you don't need to do some security measures there that could end up as significant overhead (for example, JS engines have some anti-heapspray techniques that do things to typed arrays - transferring large arrays between the NaCl sandbox and the JS sandbox might want similar things). But maybe not. Regardless, I think there are more suitable technologies for codecs on the web: A lot can be done in WebGL shaders (Broadway is starting to work on that), and proposed web standards like WebCL and RiverTrail look promising too.
- tlrobinson 15y agoTo be honest I haven't looked at NaCl closely, I was just giving an example of the kind of thing I'm talking about. Is there any way to make network requests and draw to the screen from within the sandbox, or does all IO need to be done in JavaScript?