Differences between Box2D 'Web' and 'asm.js'

Discussion and feedback on Construct 2

Post » Mon Feb 02, 2015 8:01 pm

The new C2 version comes with improvements to the asm.js, and from what I could read, it's far better than the web version of Box2D.

So, I made a test to compare both:
Hundreds of squares, with the physics behavior, falling in a concave platform. But, I couldn't notice any difference of performance between both..

So.. that's my question: where we can see the said difference?
B
20
S
4
Posts: 385
Reputation: 2,270

Post » Mon Feb 02, 2015 10:32 pm

Mobiles most likely, where memory is much more critical
B
73
S
13
G
8
Posts: 1,972
Reputation: 9,791

Post » Mon Feb 02, 2015 10:49 pm

I'd be curious to see your performance test because my physics stress test (basically filling up a bucket with as many small objects as possible) gets to a 3x higher object count with asm.js. The asm.js version is like a native-compiled version which browsers should be able to optimise like native code.
Scirra Founder
B
383
S
224
G
86
Posts: 24,118
Reputation: 190,444

Post » Mon Feb 02, 2015 11:14 pm

QuaziGNRLnose wrote:Mobiles most likely, where memory is much more critical

Hm.. makes sense. hehe

Ashley wrote:I'd be curious to see your performance test because my physics stress test (basically filling up a bucket with as many small objects as possible) gets to a 3x higher object count with asm.js. The asm.js version is like a native-compiled version which browsers should be able to optimise like native code.

Here is the capx: https://dl.dropboxusercontent.com/u/191 ... Box2D.capx
Till 800 objects, my fps is stable. Then, goes down (web and asm.js).
I don't know why, but I'm getting exactly the same performance with both..

My specs:
GTS 450
X4 955
4gb RAM

And Ashley, one more question: Web and asm.js handle just the physics behavior or every collision and things like that?
Thanks.
B
20
S
4
Posts: 385
Reputation: 2,270

Post » Tue Feb 03, 2015 1:48 am

@Zathan, I agree with your assessment - I've submitted this on the back of another bug report here.
I only occasionally visit - I'm learning C# for Unity, but c2 is still a respectable game engine imo....
B
69
S
18
G
65
Posts: 2,195
Reputation: 41,465

Post » Tue Feb 03, 2015 2:12 am

@Zathan

Using your test capx (in chrome v40.0.2214.93 m) :

asm.js
(roughly) 1200 @ 60 fps

web
(roughly) 1300 @ 60 fps

From my experience Box2D web has shown better performance. I have a feeling this correlates to system specs and vid cards.

System Specs:
R196
Win 7 64
Xeon E3-1230 @ 3.30GHz
32 GB
GTX 650Ti
Image Image Image
B
61
S
19
G
6
Posts: 325
Reputation: 7,945

Post » Tue Feb 03, 2015 8:57 pm

Thanks guys, now I know it isn't just on me :D

And @Ashley, any idea why this happens?
B
20
S
4
Posts: 385
Reputation: 2,270

Post » Wed Feb 04, 2015 1:24 am

UPDATE:

Updated chrome using R196.2 got better results. In fact asm.js is performing a lot better for me now.

Using your test capx (in chrome v40.0.2214.94 m) :

asm.js
(roughly) 1300 @ 60 fps

web
(roughly) 1300 @ 60 fps
Image Image Image
B
61
S
19
G
6
Posts: 325
Reputation: 7,945

Post » Wed Feb 04, 2015 1:55 am

I submitted this as a bug report and would be interested if anyone else can reproduce what I see on my system....

Try this capx:
physics_asm_v_box2d.capx


It's a variation of the one in the bug report. It creates a large number of physics balls and then just runs as they bounce around in zero gravity - the idea was to create enough balls to stress the system but to maintain near 60 fps in r195. The layout also displays a horizontal scrolling graph of dt so any variations can be seen over time. The number that stresses my system on Chrome is 1600 - so you might need to tweak that up or down depending on what hardware you're using.

To my eye it appears that r196.2 causes more and more frequent frame drops (large dt values > 16 ms) than seemed apparent in r195. This might be a bespoke finding just to my system so it would be good for others to test it and see if it's either just me... It's also worth noting that I also consistently see no discernible improvement in performance when using asm.js over the standard box.2d.

r195 v r196.2 physics perf.png
You do not have the required permissions to view the files attached to this post.
I only occasionally visit - I'm learning C# for Unity, but c2 is still a respectable game engine imo....
B
69
S
18
G
65
Posts: 2,195
Reputation: 41,465

Post » Fri Feb 06, 2015 3:13 pm

@Colludium

What a nice benchmark. Really awesome. hehe
unfortunately, that "bug" remains a mystery to me.. Ashley said that his tests gets 3x higher fps in asm.js. '-'
Oh, and again my previous question: Web and asm.js handle just the physics behavior or every collision and things like that?
Thanks.
B
20
S
4
Posts: 385
Reputation: 2,270

Next

Return to Construct 2 General

Who is online

Users browsing this forum: technofou and 8 guests