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
Go 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:
one year 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
Max with apply
317.6M/s
Max with spread operator
80.2M/s
View exact numbers
Test name
Executions per second
✓
Max with apply
317,644,960 Ops/sec
Max with spread operator
80,219,624 Ops/sec
Related benchmarks
Math.max with apply vs spread
Math.max with apply vs spread vs reduce
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?