Here is a nice little piece of code that can help you measure measure time: (actually using it in node.js)
var timer = function(){
var start,
end;
return {
start: function(){
start = new Date().getTime();
},
stop: function(){
end = new Date().getTime();
},
getTime: function(){
return time = end - start;
}
};
};
Here is the usage:
var t = timer(); t.start(); // do something t.stop(); console.log(t.getTime());