Sum and Product

Benchmark created on


Setup

let x = [1, 2, 3, 4, 5, 6, 6, 7, 8, 9]

Test runner

Ready to run.

Testing in
TestOps/sec
Sum
let total = 0;
for (const i of x) { total+= i }
ready
Product
let total = 1;
for (const i of x) { total*= i }
ready
Seperate
let total = 0;
for (const i of x) { total+= i }
let total2 = 1;
for (const i of x) { total2*= i }
ready
Together
let total = 0;
let total2 = 1;
for (const i of x) {
total+= i
total2*= i
}
ready

Revisions

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