recursion x loop

JavaScript performance comparison

Test case created

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
recursion
function factorial(i) {
  if (i == 0) return 1;
  return (factorial(i - 1) * i);
}
factorial(7);
pending…
loop
var i, result = 1;
for (i = 0; i <= 7; i++){
 if (i == 0)
  result *= 1;
 else
  result *= i;
}
pending…

You can edit these tests or add even more tests to this page by appending /edit to the URL.

Compare results of other browsers

0 comments

Add a comment