dot product

Benchmark created on


Setup

let v=Array.from({length:1e4},()=>Math.random())
let w=Array.from({length:1e4},()=>Math.random())

Test runner

Ready to run.

Testing in
TestOps/sec
reduce
v.reduce((l,r,i)=>l+r*w[i],0)
ready
for loop
let s2=0,l2=v.length;for(let i2=0;i2<l2;i2++)s2+=v[i2]*w[i2]
ready

Revisions

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