craftyjs/Crafty — pull request #388 by starwed (2012-12-15 02:23:34+00:00)
Title: Better timing measurements:  debugStep() is an alternate game loop with logging info.

This adds a function, Crafty.timer.debugStep(), that can replace Crafty.timer.step().

It records the exact timing of events inside the game loop (such as when frames and draw occur) and passes that along by triggering a "TimeLog" event.

This is helpful in designing tests and benchmarks that measure Crafty's performance.

I liked the clarity of outright replacing the game loop to enter debug mode, but I could always refactor it to sit inside the regular step() function, toggled on/off by some conditional.