News for hackers. Stuff that matters.
Re:Physics in Javascript Using Box2D by a1k0n on Thursday November 15, 2012 @06:18PM (#4791375)
The thing about the emscripten version is that their own demos seem to GC-pause constantly on Chrome. I'm assuming the emscripten-generated code is making tons of incidental garbage, but I haven't profiled it or anything; it's all Closure-compiled and impossible to read. I'm still using the old old old actionscript port of the old version, and wish I had seen box2dweb sooner.

btw disasteroids is hilariously awesome. Great work.

Re:Physics in Javascript Using Box2D by kevingadd on Thursday November 15, 2012 @09:28PM (#4792114)
Emscripten generally speaking does not produce garbage because it uses a virtual heap. If you profile the demos using a heap profiler like Chrome's you will be able to observe this. The pauses are likely due to bugs in V8 that cause it to recompile a page's JavaScript constantly (it has a lot of them). The cost of those bugs ends up being higher than that of equivalent bugs in Firefox's JS engine because of the way V8 is designed.

Either way, though, if you have a reproduction case for those pauses you should definitely file a bug about it on the appropriate tracker - emscripten's if something is wrong with the generated code, or chromium's.

Re:Physics in Javascript Using Box2D by a1k0n on Thursday November 15, 2012 @09:33PM (#4792126)
Yeah -- I knew about the virtual heap arrays, so the GC explanation didn't make sense. I'll dig into it; thanks for the pointers.

I think you're right though. Once it's been running a while, it seems OK; so I think it was JIT compilation pauses.

Re:Physics in Javascript Using Box2D by daredevildave on Friday November 16, 2012 @07:13AM (#4793529)
We've been testing out ammo.js (Emscripten compiled Bullet) for 3D physics. In this demo http://apps.playcanvas.com/will/ammo/crates after the first couple of resets, it runs smoothly.

It does indeed seem to be the JIT warming up. The good news is that Chrome Canary is significantly smoother, so 6-8 weeks until that hits stable.

Re:Physics in Javascript Using Box2D by azakai on Friday November 16, 2012 @11:26PM (#4797179)
Canary takes 0-6 weeks til Dev, then 6 weeks til Beta, then 6 weeks til Stable, so it's 12-18 weeks.
Re:Physics in Javascript Using Box2D by a1k0n on Saturday November 17, 2012 @05:15PM (#4799133)
Wow, yeah. That's a much more dramatic demonstration. Looks great though, once it warms up.