4 ms·
Because it's still javascript, I'm not particularly worried; Unreal support will likely be a powerful incentive to improve performance on the smaller instructio
by magicalist 14y ago
Because it's still javascript, I'm not particularly worried; Unreal support will likely be a powerful incentive to improve performance on the smaller instruction set even if asm.js itself doesn't catch on.
However, in many typical graphics-heavy cases, your statements aren't really true. Many of the heavy visual effects are offloaded to the GPU if at all possible (especially in the case of Unreal Engine's OpenGL ES path, as it has to rely on the speed of mobile CPUs otherwise), and data is preprocessed wherever possible so that it doesn't have to be done at runtime. This takes the CPU out of many of the bottlenecks where the difference between asm.js code and regular JITed js would make a large difference. If you're using Emscripten with typed arrays at all, you're going to get a huge reduction in GC pressure as well.
You will be able to scale things like physics (since something like PhysX doesn't run on mobile GPUs anyway), but any gameplay-affecting physical interactions won't be relying on actual CPU-based physics simulation.
In any case, Emscripten is a powerful tool even without asm.js, and I will bet that these demos will still run pretty well in browsers without it. Sufficient incentive (like, a popular WebGL game) would be enough to get framerates as rocksteady as what we're seeing in Firefox with support.
The big news here is that Mozilla has convinced Epic to bet on the web (where they were previously throwing all their weight behind their Flash-based engine), and they've demonstrated with a major, non-trivial piece of software how easy the porting process can be. Moreover, because it's Mozilla, we know that they'll make sure that cross-browser support is baked in, so that if or when other browsers are fast enough to play these games, they'll be able to.
Serious kudos to Mozilla for this win.
- jlongster 14y agoYou're right that a lot of the scaling probably happens with the GPU, and that Emscripten-generated code is still the most performant javascript possible (no GC, consistently typed for inference, etc). I think there are places where the CPU is the bottleneck though, since we're talking about crazy complex 3d games. Managing a large scene graph, and updating physics are some examples. Simply reducing the viewable distance is a huge help when you are CPU bottlenecked for those reasons (most likely physics). Agreed that no matter what, the Unreal port will help optimize the typed array/no GC code path! Exciting times.
- cromwellian 14y agoModern game engines also leverage SIMD and multi-core SMP. Javascript is inherently single threaded. While there is hope in retrofitting SIMD in (Rivertrail ParallelArrays or Dart's recent work with new SIMD TypedArrays), I don't see any path for supporting multithreading. JS is inherently async and singlethreaded in its memory model. WebWorkers are not really a multithread model. Game engines could be written to leverage message passing based isolates, but in some cases, but doing it in an optimal form isn't exactly developer friendly, it's one of pains of developing the PS3 SPEs is that they didn't share system memory and you had to DMA stuff around.
- maksimlin 14y agoPerhaps this is the path you weren't seeing: http://smallcultfollowing.com/babysteps/blog/2013/03/20/parallel-js-lands/ http://smallcultfollowing.com/babysteps/blog/2013/03/20/para...
- cromwellian 14y agoI already mentioned RiverTrail stuff in another response. I don't really think it is a replacement for SSE/AVX/NEON/AltiVec.
- BrendanEich 14y agoAgreed. So we are getting together with John McCutchan who did Dart SIMD intrinsics to do same for JS via Ecma TC39 Harmony process and rapid prototyping in SpiderMonkey -- and I hope in V8 as well. /be
- cromwellian 14y ago+1 to adding the SIMD Dart types into JS. This is how I like to see Google and Mozilla working together to improve the web. (WebRTC is another fabulous cooperation)