Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
reduce vs loop
(version: 2)
Comparing performance of:
reduce vs loop vs loop2
Created:
9 years ago
by:
Registered User
Jump to the latest result
Script Preparation code:
t=new Array(500000); for (let i=0;i<t.length;i++) {t[i]=Math.random();}
Tests:
reduce
t.reduce((p,c) => p+c, 0);
loop
(() => { let i=0, res = 0; for (;i<t.length;i++) res += t[i]; return res;})();
loop2
(() => { var i, res; for (i=res=0;i<t.length;i++) res += t[i]; return res;})();
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
reduce
loop
loop2
Fastest:
N/A
Slowest:
N/A
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Related benchmarks:
reduce vs loop
Fill array with random integers
array vs int16array try catch
array vs float64 for io and slice
array vs float64 for io and slice (fixed)
Comments
Confirm delete:
Do you really want to delete benchmark?