Re:Box2d Revisited
by evmar on Thursday April 25, 2013 @07:37PM
(#5610654)
I'm curious whether the performance varies if you used a C compiler from the last five years -- GCC 4.2.1 was released in July 2007. (I'm not claimed the author of the post is unfairly biasing the results, I'm just honestly curious.)
Re:Box2d Revisited
by joelgwebber on Thursday April 25, 2013 @08:05PM
(#5610749)
FWIW, I just ran it through Clang 4.1 (the standard on XCode these days), and got roughly identical performance. I'm still compiling gcc 4.8 just to be sure, but it seems unlikely to make much of a difference.
Re:Box2d Revisited
by joelgwebber on Thursday April 25, 2013 @09:20PM
(#5610965)
Good point. Apple helpfully reports the rather confusing version string "Apple clang version 4.1 (tags/Apple/clang-421.11.65) (based on LLVM 3.1svn)" :P
Re:Box2d Revisited
by mrmiller on Thursday April 25, 2013 @08:06PM
(#5610754)
Interesting how JS still doesn't live up to AS3. Everyone always discredits Flash... but if you're trying to make a Physics-based browser game, it still seems appropriate!
Re:Box2d Revisited
by azakai on Thursday April 25, 2013 @09:07PM
(#5610920)
Well, the asm.js version of the benchmark is JS, and it outperformed AS3. Although as cpleppert said, perhaps an alchemy version for Flash would be faster than AS3, that would be interesting to see.
But, I'm not aware of an alchemy version of Box2D for Flash that is convenient to use from normal Flash (what presumably the rest of the game is written in), while for asm.js there is such a version (that is easily usable from normal JS), here's a demo
Re:Box2d Revisited
by cpleppert on Thursday April 25, 2013 @08:59PM
(#5610902)
You could get even better performance if you directly coded against the alchemy VM instructions or used alchemy directly. This would be comparable to asm.js or coding Java against the unsafe memory operators.
Re:Box2d Revisited
by lutusp on Friday April 26, 2013 @05:45AM
(#5612152)
For asm.js to be 90% slower than c++, it would have to run at 10% the speed of c++, not 51% of its speed, which is what the data shows. 100% slower is not 1/2 the speed, it's no speed at all.
Take some speed x. Increasing it by 100% gives 2x. Decreasing it by 100% gives zero.
Expressed another way, 100% of x is x. Add 100% = 2x, Subtract 100% = zero. The original claim is "90% slower." Clearly the OP either meant 51% slower or 49% slower, depending on how one reads it.
a = 2.62
b = 5.19
a / b = 0.5048, or 50.48%: "b has 50.48 percent the speed of a".
EDIT: wow, once again downvoted for being right and proving it.
Re:Box2d Revisited
by jules on Friday April 26, 2013 @06:13AM
(#5612211)
English conventions are inconsistent. "X is 2x slower than Y" usually means that Y runs at twice the speed of X. Since 90% = 0.9, "X is 90% slower than Y" would mean that X is actually faster than Y. Therefore it's better to state it in an unambiguous way, e.g. X took 2x as much time as Y, or just look at the numbers directly.
Re:Box2d Revisited
by azakai on Thursday April 25, 2013 @10:52PM
(#5611236)
You can grab his repo and try it yourself, but as I commented on the blogpost, on my machine I see firefox without asm.js optimizations and chrome as being about the same speed, both of them are half the speed of firefox with asm.js optimizations. (I don't have a machine with safari to test on.)
Which means the asm.js version is faster than other JS versions, even without specific asm.js optimizations.
Re:Box2d Revisited
by joelgwebber on Thursday April 25, 2013 @07:06PM
(#5610543)
It looks like Farseer is based on Box2D, but extended, so it makes a kind of sense. I suspect the .NET VM performance will be somewhere around what the JVM gets, so it shouldn't be too much of a surprise.
Re:Box2d Revisited
by joelgwebber on Thursday April 25, 2013 @06:54PM
(#5610482)
I must admit to being unfamiliar with Farseer, but if you feel like submitting a pull request, I'll figure out a way to run it on my Mac (I presume the "platform" you're referring to is .NET, or perhaps WinMo).
Changing gcc to use -O2 instead of -O3 gets: 1.562500 +/- 3.630922.
Clang 3.3 will be released soon.
http://goput.it/p1l.png
But, I'm not aware of an alchemy version of Box2D for Flash that is convenient to use from normal Flash (what presumably the rest of the game is written in), while for asm.js there is such a version (that is easily usable from normal JS), here's a demo
http://kripken.github.io/box2d.js/webgl_demo/box2d.html
So comparing currently usable versions of Box2D, the fastest JS one (the asm.js one) is faster than the fastest Flash one.
http://imgur.com/fBZZXYY.png
Take some speed x. Increasing it by 100% gives 2x. Decreasing it by 100% gives zero.
Expressed another way, 100% of x is x. Add 100% = 2x, Subtract 100% = zero. The original claim is "90% slower." Clearly the OP either meant 51% slower or 49% slower, depending on how one reads it.
a = 2.62
b = 5.19
a / b = 0.5048, or 50.48%: "b has 50.48 percent the speed of a".
EDIT: wow, once again downvoted for being right and proving it.
Yes, and it's an argument for expressing these ideas with mathematics instead of words.
> Therefore it's better to state it in an unambiguous way, e.g. X took 2x as much time as Y, or just look at the numbers directly.
Complete agreement.
Which means the asm.js version is faster than other JS versions, even without specific asm.js optimizations.
http://farseerphysics.codeplex.com/
:(
You may want to read this to catch up: http://en.wikipedia.org/wiki/Mono_(software)