Skip to content

Instantly share code, notes, and snippets.

@daihuaye
Created December 12, 2014 08:43
Show Gist options
  • Select an option

  • Save daihuaye/ff41544129b7c035e84a to your computer and use it in GitHub Desktop.

Select an option

Save daihuaye/ff41544129b7c035e84a to your computer and use it in GitHub Desktop.
performance time test
SpeedTest.prototype = {
startTest: function() {
var beginTime, endTime, sumTime = 0;
for(var i = 0, x = this.repetitions; i < x; i++ ) {
beginTime = +new Date();
this.testImplement( this.testParams );
endTime = +new Date();
sumTime += endTime - beginTime;
}
this.average += sumTimes / this.repetitions;
return console.log('Average execution across ' + this.repetitions + ": " + this.average);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment