View Single Post
Old 01-11-2013, 01:31 AM   PM User | #3
rnd me
Senior Coder

 
rnd me's Avatar
 
Join Date: Jun 2007
Location: Urbana
Posts: 3,452
Thanks: 9
Thanked 466 Times in 450 Posts
rnd me is a jewel in the roughrnd me is a jewel in the roughrnd me is a jewel in the rough
you would be better off using setTimeout() or requestAnimationFrame() so that your work loop cannot get backed up.

if something takes more than the frame display period, the next interval can get behind schedule. As these lagging executions stack up, the stack grows larger and memory consumption goes up. Some browsers throw away the backlog (chrome), while others simply grind to a halt (IE7).

in a game loop, you want to fire as often as possible, not on a pre-determined schedule: nobody will complain that your game has "too many FPS"...
__________________
my site (updated 5/13)
STATS (2013/5) HTML5:90.2% MOB:14% IE7:0.5% IE8:8.8% IE9:11.4% IE10:6.5%
rnd me is offline   Reply With Quote