Box2d Revisited
j15r.com
j15r.com
gcc 4.6.3: 3.554688 +/- 4.786550
clang trunk: 3.593750 +/- 4.798172
Chrome: 41.03515625 +/- 9.331709130062185
Which puts Chrome at about 11x these native compilers, consistent with the blog post.Clang 3.3 will be released soon.
gcc 4.8.0: 1.640625 +/- 3.703323
clang 3.2: 1.718750 +/- 3.772718
chrome : 23.28515625 +/- 3.636932727324763
So chrome is about ~14x the native compilers.Changing gcc to use -O2 instead of -O3 gets: 1.562500 +/- 3.630922.
CFLAGS=-s -O3 -msse -mfpmath=sse -ffast-math -fomit-frame-pointer -IBox2D_v2.2.1 -DNDEBUG=1
Using -Ofast gets the same results as -O2.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.
C (gcc 4.2.1) 2.62 +/- 0.24 1.0x
NaCl (x86-32) 3.39 +/- 0.25 1.3x
asm.js (Firefox Nightly) 5.12 +/- 0.59 1.9x
NaCl is 30% slower, asm.js is 90% slower.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)