Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
A quick JavaScript function performance test on the browser console
var i =;
yourFunction(); - i;
//Or make a helper function, like this:
function performanceTest(testFunction, iterations) {
'use strict';
var sum = 0;
var start =;
for (var i = 0; i < iterations; i++) {
var - start;
return time;
//And use it like this:
}, 1000);
//In NodeJS you would need to use process.hrtime() instead of and it behaves a little differently.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.