Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Math.max with apply vs spread vs reduce on object array - v1
(version: 0)
Compare the new ES6 spread operator with the Math.max.apply method
Comparing performance of:
Max with apply vs Max with spread operator vs Reduce
Created:
one year ago
by:
Guest
Jump to the latest result
Script Preparation code:
var arr = [] for (i = 0; i < 50000; i++) { arr.push({ value: Math.random() * i }) }
Tests:
Max with apply
Math.max.apply(Math, arr.map(e=>e.value))
Max with spread operator
Math.max(...arr.map(e=>e.value))
Reduce
arr.reduce((a, b) => Math.max(a, b.value), 0)
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
Max with apply
Max with spread operator
Reduce
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!
Comments
Confirm delete:
Do you really want to delete benchmark?