Live data from Hacker News

Box2d Revisited

j15r.com

31–40 of 44 posts

Re: Box2d Revisited

#31
post #21

I'd love to see the numbers for the asm.js version running in Safari and Chrome

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.

Thanks. I didn't do it myself because I wasn't able to find the asm.js version version, I must be blind.

Re: Box2d Revisited

#32
post #28
post #27

Earlier quoted context omitted.

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.

Your conclusion doesn't follow from your data. 5.12 is not 90% slower than 2.62, it's 51% slower.

He says NaCl is 30% slower than _c++_, asm.js is 90% slower than _c++_ which is correct.

Re: Box2d Revisited

#33
post #6

I can't zoom on this page with my phone and, due to that, can't read it at all except with the "Reader" function.

That enormous position:fixed header makes it difficult to read even on a desktop.

Re: Box2d Revisited

#34
post #32
post #28

Earlier quoted context omitted.

Your conclusion doesn't follow from your data. 5.12 is not 90% slower than 2.62, it's 51% slower.

He says NaCl is 30% slower than _c++_, asm.js is 90% slower than _c++_ which is correct.

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

#35
post #34
post #32

Earlier quoted context omitted.

He says NaCl is 30% slower than _c++_, asm.js is 90% slower than _c++_ which is correct.

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%…

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

#36
post #35
post #34

Earlier quoted context omitted.

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%…

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.

> English conventions are inconsistent.

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.

Re: Box2d Revisited

#37
post #19

Earlier quoted context omitted.

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.

What about -Ofast which enables -ffast-math?

The makefile supplied with the repo specifies -ffast-math. It uses these CFLAGS:

    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.

Re: Box2d Revisited

#38

Not too useful as does not include one of the very popular ports and an additional major platform: http://farseerphysics.codeplex.com/ :(

It's perfectly useful as comparison of browser-based Box2d ports, and how they perform relative to the original C library.

Farseer can run in browser using Silverlight.

Re: Box2d Revisited

#39

Not too useful as does not include one of the very popular ports and an additional major platform: http://farseerphysics.codeplex.com/ :(

It's perfectly useful as comparison of browser-based Box2d ports, and how they perform relative to the original C library.

Is NaCl even cross-browser?

Re: Box2d Revisited

#40

Earlier quoted context omitted.

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).

It doesn't make sense to test farseer on anything but Windows. I would be curious to see how .NET stands these days with relation to Java and native.

>> It doesn't make sense to test farseer on anything but Windows

You may want to read this to catch up: http://en.wikipedia.org/wiki/Mono_(software)

Post reply on HN