theshock / libcanvas

LibCanvas - Canvas Javascript library
http://libcanvas.com
435 stars 85 forks source link

Optimizing performance #43

Closed stevozilik closed 12 years ago

stevozilik commented 12 years ago

Hi,

I have a libcanvas with lots of shapes on it, which is dramatically reducing performance of the application. The objects are moving around, animating etc... are there any basic performance tips as how to handle these situation to get good performance.

I've tried to do

libcanvas.freeze() [handle all the moving of objects] libcancas.freeze(false),

but that seems to stop rendering alltogether.

Is there any buffering that I could use?

Thanks, Stevo

theshock commented 12 years ago

Hello! How much objects are at the canvas? All of them are changed each frame? All of them are visible each frame?

stevozilik commented 12 years ago

Hello,

there is:

Each moving object consist of 3 mandatory shapes (2 circles and one text (custom) shape) + up to 5 occasional shapes that animate (change size, fade in, fade out) about 10% of the time (not more than 3 at a time).

The moving objects move at a rate 15 fps (same fps is set for the canvas).

Worst case scenario there is 100 - 200 moving shapes (20% of them animating), again moving at a rate of 15fps (that's customizable) so every 66 mls (interval that kicks in and calculates new positions of the shapes).

You can see the canvas at http://simracing-cz.liveracers.info/Live/?server=SR4%20-%20TEST%20server (it's not up 24/7 but if you look now, there will be stuff happening)

The best performance is in Chrome, than Opera, than Firefox, than IE 9

I'm desperately looking for ways to improve the performance

Thanks, Stevo

theshock commented 12 years ago

Sorry it took me so long to answer. Please, write me to skype shock13666 - I'll help you there.