Test name | Executions per second |
---|---|
reduce | 897091.4 Ops/sec |
loop | 55917.8 Ops/sec |
loop2 | 58503.8 Ops/sec |
t = [];
for (let i=0; i < 50; i++) t.push(Math.random());
t.reduce((p,c) => p+c, 0);
(() => {
let res = 0;
for (let i=0;i<t.length;i++) res += t[i];
return res;})();
(() => {
var i, res;
for (i=res=0;i<t.length;i++) res += t[i];
return res;})();