bgx-cached-values-func

JavaScript performance comparison

Test case created by bognix

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
cached
function factorial(n) {
        if (isFinite(n) && n > 0 && n == Math.round(n)) {
                if (!(n in factorial)) {
                        factorial[n] = n*factorial(n-1)
                }
                return factorial[n];
        } else {
                return NaN;
        }
}

factorial[1]=1

factorial(20)
pending…
not-cached
function standardFactorial(n) {
                if (n == 0) {
                        return 1
                } else {
                        return standardFactorial(n-1)*n;
                }
        }

standardFactorial(20)
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