box2d.js icon indicating copy to clipboard operation
box2d.js copied to clipboard

inconsistent performance on first run

Open martin-gorner opened this issue 12 years ago • 3 comments

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

martin-gorner avatar Oct 31 '12 16:10 martin-gorner

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.

kripken avatar Oct 31 '12 17:10 kripken

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 [email protected]

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

martin-gorner avatar Nov 02 '12 09:11 martin-gorner

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

kripken avatar Nov 02 '12 23:11 kripken