Simple Benchmark Snippet
If you need to quickly benchmark some code in firefox (maybe chrome too) try the following function to make you life easier…
function benchmark(name, fn, n) {
console.time(name);
for(var i = 0; i < n; i++)
fn();
console.timeEnd(name);
}
…where name is an arbitrary test name, fn is the function you want to test, and n is the times to run the function.
