Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Add benchmark for the new Emscripten approach. #4

merged 1 commit into from Feb 27, 2012


None yet
2 participants

nathanhammond commented Feb 25, 2012

Alon has released a version of box2d with JS bindings that I feel is worth adding to the collection.

@nathanhammond nathanhammond commented on the diff Feb 25, 2012

+ }
+ x.op_add(deltaX);
+ }
+ for (var i = 0; i < WARMUP; ++i) {
+ world.Step(1.0/60.0, 3, 3);
+ }
+ var times = new Array(FRAMES);
+ for (var i = 0; i < FRAMES; ++i) {
+ var start = clock();
+ world.Step(1.0/60.0, 3, 3);
+ var end = clock();
+ times[i] = end - start;
+ if (DEBUG) print([topBody.GetPosition().get_y(), topBody.GetMass()]);

nathanhammond Feb 25, 2012


This line increases run time by ~10% in Chrome.


joelgwebber Feb 27, 2012


The existence of this line, or only with DEBUG enabled? If it's the very existence, that would be somewhat surprising, but I think it would be perfectly fair to remove it. But DEBUG should be off by default -- this is just a quick way to confirm that it's producing sane values without having to hook it up to a renderer.


joelgwebber commented Feb 27, 2012

Thanks for doing this. I'll go ahead and merge it now so I can start getting up-to-date numbers. If there are further tweaks or modifications, please feel free to send 'em my way.

joelgwebber added a commit that referenced this pull request Feb 27, 2012

Merge pull request #4 from nathanhammond/master
Add benchmark for the new Emscripten approach.

@joelgwebber joelgwebber merged commit 11160ad into joelgwebber:master Feb 27, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment