Function new vs. call

Benchmark created by Wesley on


Setup

function doSomething ( ) {
        var j;
        for ( var i = 0; i < 1000; i ++ ) {
                j ++;
        }
        return { j: j };
    }

Test runner

Ready to run.

Testing in
TestOps/sec
new
var something = new doSomething;
ready
call
var something = doSomething();
ready

Revisions

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

  • Revision 1: published by Wesley on