sumarry

Benchmark created on


Description

sum the array of positive integers

Preparation HTML

<script>
const count = 2**16;
const array = new Uint8Array(count);
for (let i = 0; i < count; i++) {
    array[i] = Math.random() * 256;
}
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
declared function in foreach
let sum = 0;
function addToSum(item) {
	sum += item;
}
array.forEach(addToSum);
ready
inline function expression in foreach
let sum = 0;
array.forEach(item => sum += item);
ready

Revisions

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