Skip to content

Instantly share code, notes, and snippets.

@furf
Created October 22, 2009 13:53
Show Gist options
  • Save furf/215952 to your computer and use it in GitHub Desktop.
Save furf/215952 to your computer and use it in GitHub Desktop.
function stress (fn /*, n */) {
var n = arguments[1] || 1000,
i, t,
s = new Date();
for (i = 0; i < n; i++) {
fn();
};
t = ((new Date()) - s);
return {
handler: fn,
total: t,
each: t / n
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment