Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Math.max with apply vs spread (small size)
(version: 1)
Compare the new ES6 spread operator with the Math.max.apply method
Comparing performance of:
Max with apply vs Max with spread operator
Created:
one year ago
by:
Registered User
Jump to the latest result
Script Preparation code:
var arr = [] for (i = 0; i < 5; i++) { arr.push(Math.random() * i) }
Tests:
Max with apply
Math.max.apply(Math, arr)
Max with spread operator
Math.max(...arr)
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Max with apply
Max with spread operator
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
9 months ago
)
User agent:
Mozilla/5.0 (X11; Linux x86_64; rv:141.0) Gecko/20100101 Firefox/141.0
Browser/OS:
Firefox 141 on Linux
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Max with apply
317644960.0 Ops/sec
Max with spread operator
80219624.0 Ops/sec
Related benchmarks:
Spread vs. Apply
Spread vs. Apply
Math.max with apply vs spread
Math.max with apply vs spread vs reduce
Math.max with apply vs spread vs reduce 2
Math.max - apply, call vs spread ~50K
Math.max.apply vs Math.max spread
Math.max with apply vs spread vs reduce 10k elements
Math.max with apply vs spread vs reduce on object array
Comments
Confirm delete:
Do you really want to delete benchmark?