reduce

Benchmark created on


Setup

const x = new Uint8Array(1e6);

Test runner

Ready to run.

Testing in
TestOps/sec
reduce
const y = x.reduce((a,v)=>a+v,0);
ready
for
let y = 0;

for (let i = 0, ii = x.length; i < ii; i++) y += x[i];
ready
foreach
let y = 0;

foreach (const v of x) y += v;
ready

Revisions

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