kripken / box2d.js

Port of Box2D to JavaScript using Emscripten
1.32k stars 198 forks source link

Fork with support 2.3.1 version of Box2D and debug output #64

Open dmagunov opened 9 years ago

dmagunov commented 9 years ago

Hello guys,

Please check my updates to Your project with support of latest Box2D library and debug output:

source code | demo | article

Thanks!

kripken commented 9 years ago

Nice work!

Is there a performance difference? Seems very similar to me.

Should we merge this in?

dmagunov commented 9 years ago

Thanks!

I also don't see any performance difference. It would be nice to merge this into the main branch. If you would need any help, please let me know.

josephrocca commented 8 years ago

Great work @dmagunov - and thanks for the article. I know this is old, but I'm getting a significantly better frame rate with box2dweb (on the domino tower). Anybody know why that might be? From what I've heard it should be the other way around, right?

kripken commented 8 years ago

That does seem surprising - do you have links to parallel demos showing that?

josephrocca commented 8 years ago

By parallel demos, do you mean these (provided by @dmagunov above)? http://argadnet.com/demo/rube_testbed/box2dweb/index.html http://argadnet.com/demo/rube_testbed/box2djs/index.php

Weirdly enough, the domino tower one is now running at about the same fps for both. It may have something to do with the way each library handles memory, because my computer was a little starved for RAM (due to other applications hogging it) when I last tried. That's just a guess though

kripken commented 8 years ago

Thanks, sorry I missed those links before.

Profiling domino tower now, I see most time in the box2dweb version in draw, and in the box2d.js version in drawPolygon. In other words,

  1. Most time in both demos seems to be spent in drawing, not physics - which makes sense, as it's rendering a lot of small objects, using canvas2D which tends to be slow at that.
  2. But the different methods also appear to be in different files - they are not rendering using a parallel, shared renderer?

Overall, those suggest to me that at least for domino tower, this is mostly benchmarking the rendering systems, not the physics systems.

josephrocca commented 8 years ago

Ahh, good spotting. If only we had a nice physics abstraction layer to do some proper tests (particularly interested in how p2 compares to your box2d port)