Script Preparation code:
x
 
function genArray(shape) {
    var random = function () { return Math.random(); };
    var arr = [];
    for (var i = 0; i < 1; i++) {
        arr.push(genShape(shape, random()));
    }
    return arr;
}
function genShape(shape, number) {
    shape = shape % 10;
    var obj = {};
    for (var i = 0; i < shape; i++) {
        obj["foo" + i] = "bar";
    }
    obj.a = number;
    for (i = shape; i <= 10; i++) {
        obj["bar" + i] = "foo";
    }
    return obj;
}
var arr0 = genArray(0);
var arr1 = genArray(1);
var arr2 = genArray(2);
var arr3 = genArray(3);
var arr4 = genArray(4);
var arr5 = genArray(5);
var arr6 = genArray(6);
var arr7 = genArray(7);
var arr8 = genArray(8);
var arr9 = genArray(9);
function doOverloadedTest() {
    var res = 0;
    res += sum(arr0);
    res += sum(arr1);
    res += sum(arr2);
    res += sum(arr3);
    res += sum(arr4);
    res += sum(arr5);
    res += sum(arr6);
    res += sum(arr7);
    res += sum(arr8);
    res += sum(arr9);
    return res;
}
function sum(arr) {
    var res = 0;
    for (var i = 0; i < arr.length; i++) {
        res += arr[i].a;
    }
    return res;
}
function sum0(arr) { var res = 0; for (var i = 0; i < arr.length; i++) {
    res += arr[i].a;
} return res; }
function sum1(arr) { var res = 0; for (var i = 0; i < arr.length; i++) {
    res += arr[i].a;
} return res; }
function sum2(arr) { var res = 0; for (var i = 0; i < arr.length; i++) {
    res += arr[i].a;
} return res; }
function sum3(arr) { var res = 0; for (var i = 0; i < arr.length; i++) {
    res += arr[i].a;
} return res; }
function sum4(arr) { var res = 0; for (var i = 0; i < arr.length; i++) {
    res += arr[i].a;
} return res; }
function sum5(arr) { var res = 0; for (var i = 0; i < arr.length; i++) {
    res += arr[i].a;
} return res; }
function sum6(arr) { var res = 0; for (var i = 0; i < arr.length; i++) {
    res += arr[i].a;
} return res; }
function sum7(arr) { var res = 0; for (var i = 0; i < arr.length; i++) {
    res += arr[i].a;
} return res; }
function sum8(arr) { var res = 0; for (var i = 0; i < arr.length; i++) {
    res += arr[i].a;
} return res; }
function sum9(arr) { var res = 0; for (var i = 0; i < arr.length; i++) {
    res += arr[i].a;
} return res; }
function doSplitTest() {
    var res = 0;
    res += sum0(arr0);
    res += sum1(arr1);
    res += sum2(arr2);
    res += sum3(arr3);
    res += sum4(arr4);
    res += sum5(arr5);
    res += sum6(arr6);
    res += sum7(arr7);
    res += sum8(arr8);
    res += sum9(arr9);
    return res;
}
var sumSplit = (function () {
    var res = function sum(arr) {
        var res = 0;
        for (var i = 0; i < arr.length; i++) {
            res += arr[i].a;
        }
        return res;
    };
    res.sum0 = function sum(arr) { var res = 0; for (var i = 0; i < arr.length; i++) { res += arr[i].a; } return res; };
    res.sum1 = function sum(arr) { var res = 0; for (var i = 0; i < arr.length; i++) { res += arr[i].a; } return res; };
    res.sum2 = function sum(arr) { var res = 0; for (var i = 0; i < arr.length; i++) { res += arr[i].a; } return res; };
    res.sum3 = function sum(arr) { var res = 0; for (var i = 0; i < arr.length; i++) { res += arr[i].a; } return res; };
    res.sum4 = function sum(arr) { var res = 0; for (var i = 0; i < arr.length; i++) { res += arr[i].a; } return res; };
    res.sum5 = function sum(arr) { var res = 0; for (var i = 0; i < arr.length; i++) { res += arr[i].a; } return res; };
    res.sum6 = function sum(arr) { var res = 0; for (var i = 0; i < arr.length; i++) { res += arr[i].a; } return res; };
    res.sum7 = function sum(arr) { var res = 0; for (var i = 0; i < arr.length; i++) { res += arr[i].a; } return res; };
    res.sum8 = function sum(arr) { var res = 0; for (var i = 0; i < arr.length; i++) { res += arr[i].a; } return res; };
    res.sum9 = function sum(arr) { var res = 0; for (var i = 0; i < arr.length; i++) { res += arr[i].a; } return res; };
    return res;
})();
function doAutoSplitTest() {
    var res = 0;
    res += ((sumSplit && sumSplit.sum0) || sumSplit)(arr0);
    res += ((sumSplit && sumSplit.sum1) || sumSplit)(arr1);
    res += ((sumSplit && sumSplit.sum2) || sumSplit)(arr2);
    res += ((sumSplit && sumSplit.sum3) || sumSplit)(arr3);
    res += ((sumSplit && sumSplit.sum4) || sumSplit)(arr4);
    res += ((sumSplit && sumSplit.sum5) || sumSplit)(arr5);
    res += ((sumSplit && sumSplit.sum6) || sumSplit)(arr6);
    res += ((sumSplit && sumSplit.sum7) || sumSplit)(arr7);
    res += ((sumSplit && sumSplit.sum8) || sumSplit)(arr8);
    res += ((sumSplit && sumSplit.sum9) || sumSplit)(arr9);
    return res;
}
window.doOverloadedTest = doOverloadedTest;
window.doSplitTest = doSplitTest;
window.doAutoSplitTest = doAutoSplitTest;
Tests:
  • Overloaded sum test

     
    window.doOverloadedTest()
  • Split sum test

     
    window.doSplitTest()
  • Auto split test

     
    window.doAutoSplitTest()
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Overloaded sum test
    Split sum test
    Auto split test

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 8 years ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.116 Safari/537.36
Chrome 53 on Mac OS X 10.11.6
View result in a separate tab
Test name Executions per second
Overloaded sum test 356320.9 Ops/sec
Split sum test 321945.5 Ops/sec
Auto split test 273571.9 Ops/sec