Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Sort vs reduce with objects
(version: 1)
Sort and reduce when used with an object
Comparing performance of:
Reduce vs Sort
Created:
one year ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
var a = Array.from({length:500},()=>{ return {x: Math.random(), y: Math.random()};})
Tests:
Reduce
a.reduce((a,c) => a.x > c.x ? a : c)
Sort
a.sort((a,c) => a.x > c.x ? -1 : 1)
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Reduce
Sort
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36
Browser/OS:
Chrome 136 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Reduce
1930259.5 Ops/sec
Sort
171250.5 Ops/sec
Related benchmarks:
sort vs reduce
sort vs reduce
sort vs reduce
sort vs reduce: small set
sort v reduce
sorting speed
sort vs reduce for a few elements
sort vs reduce v2
sort vs reduce v3
Comments
Confirm delete:
Do you really want to delete benchmark?