kripken / box2d.js

Port of Box2D to JavaScript using Emscripten
1.33k stars 196 forks source link

inconsistent performance on first run #11

Open martin-gorner opened 11 years ago

martin-gorner commented 11 years ago

Hello

I was previously using the box2D Javascript version found here: http://box2d-js.sourceforge.net/

I ported my code to your emscripten generated version. However, I am getting completely inconsistent performance on the first run. I noticed you have the same problem in the demo:

http://syntensity.com/static/box2d.html

On the first run, as soon as the cubes start touching, the framerate goes down to 15fps or so. Then it is back to 60fps on the next runs.

My probem is that the first run is the only run people see (at least in my demo).

Is there any way to fix this ?

I am using Chrome 22 on a mac book pro.

Thanks Martin

kripken commented 11 years ago

That's a bug in chrome. They are working on it.

Workaround are to run some frames without rendering to warm up the JS engine.

martin-gorner commented 11 years ago

thanks for your answer. Do you have a bug report link so that I can find the collegues working on this and follow up on progress ?

Thanks Martin

2012/10/31 Alon Zakai notifications@github.com

That's a bug in chrome. They are working on it.

Workaround are to run some frames without rendering to warm up the JS engine.

— Reply to this email directly or view it on GitHubhttps://github.com/kripken/box2d.js/issues/11#issuecomment-9954022.

Martin Görner

kripken commented 11 years ago

There are several, for example

http://code.google.com/p/v8/issues/detail?id=2139 http://code.google.com/p/chromium/issues/detail?id=156589 http://code.google.com/p/v8/issues/detail?id=2223