Just adding a quick timer to the mix, which someone may find useful:
var timer = function(name) {
var start = new Date();
return {
stop: function() {
var end = new Date();
var time = end.getTime() - start.getTime();
console.log('Timer:', name, 'finished in', time, 'ms');
}
}
};
Ideally it would be placed in a class, and not used as a global like I did for example purposes above. Using it would be pretty simple:
var t = timer('Some label');
// code to benchmark
t.stop(); // prints the time elapsed to the js console