Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
lodash sortBy concat
(version: 0)
Comparing performance of:
lodash orderby vs native sort
Created:
2 years ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<script src='https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.11/lodash.min.js'></script>
Script Preparation code:
var orders = [ { "orderDate": "2023-11-22T04:55:58.792492Z", }, { "orderDate": "2023-11-22T05:55:58.792492Z", }, { "orderDate": "2023-11-22T01:55:58.792492Z", }, { "orderDate": "2023-12-22T01:55:58.792492Z", }, { "orderDate": "2023-11-22T04:55:58.792492Z", }, { "orderDate": "2023-11-22T05:55:58.792492Z", }, { "orderDate": "2023-11-22T01:55:58.792492Z", }, { "orderDate": "2023-12-22T01:55:58.792492Z", }, { "orderDate": "2023-11-22T04:55:58.792492Z", }, { "orderDate": "2023-11-22T05:55:58.792492Z", }, { "orderDate": "2023-11-22T01:55:58.792492Z", }, { "orderDate": "2023-12-22T01:55:58.792492Z", }, { "orderDate": "2023-11-22T04:55:58.792492Z", }, { "orderDate": "2023-11-22T05:55:58.792492Z", }, { "orderDate": "2023-11-22T01:55:58.792492Z", }, { "orderDate": "2023-12-22T01:55:58.792492Z", }, { "orderDate": "2023-11-22T04:55:58.792492Z", }, { "orderDate": "2023-11-22T05:55:58.792492Z", }, { "orderDate": "2023-11-22T01:55:58.792492Z", }, { "orderDate": "2023-12-22T01:55:58.792492Z", } ] var markers = [ { "orderDate": "2023-11-22T04:55:58.792492Z", }, { "orderDate": "2023-11-22T05:55:58.792492Z", }, { "orderDate": "2023-11-22T01:55:58.792492Z", }, { "orderDate": "2023-12-22T01:55:58.792492Z", }, { "orderDate": "2023-11-22T04:55:58.792492Z", }, { "orderDate": "2023-11-22T05:55:58.792492Z", }, { "orderDate": "2023-11-22T01:55:58.792492Z", }, { "orderDate": "2023-12-22T01:55:58.792492Z", }, { "orderDate": "2023-11-22T04:55:58.792492Z", }, { "orderDate": "2023-11-22T05:55:58.792492Z", }, { "orderDate": "2023-11-22T01:55:58.792492Z", }, { "orderDate": "2023-12-22T01:55:58.792492Z", }, { "orderDate": "2023-11-22T04:55:58.792492Z", }, { "orderDate": "2023-11-22T05:55:58.792492Z", }, { "orderDate": "2023-11-22T01:55:58.792492Z", }, { "orderDate": "2023-12-22T01:55:58.792492Z", }, { "orderDate": "2023-11-22T04:55:58.792492Z", }, { "orderDate": "2023-11-22T05:55:58.792492Z", }, { "orderDate": "2023-11-22T01:55:58.792492Z", }, { "orderDate": "2023-12-22T01:55:58.792492Z", } ] var stops = [ { "orderDate": "2023-11-22T04:55:58.792492Z", }, { "orderDate": "2023-11-22T05:55:58.792492Z", }, { "orderDate": "2023-11-22T01:55:58.792492Z", }, { "orderDate": "2023-12-22T01:55:58.792492Z", }, { "orderDate": "2023-11-22T04:55:58.792492Z", }, { "orderDate": "2023-11-22T05:55:58.792492Z", }, { "orderDate": "2023-11-22T01:55:58.792492Z", }, { "orderDate": "2023-12-22T01:55:58.792492Z", }, { "orderDate": "2023-11-22T04:55:58.792492Z", }, { "orderDate": "2023-11-22T05:55:58.792492Z", }, { "orderDate": "2023-11-22T01:55:58.792492Z", }, { "orderDate": "2023-12-22T01:55:58.792492Z", }, { "orderDate": "2023-11-22T04:55:58.792492Z", }, { "orderDate": "2023-11-22T05:55:58.792492Z", }, { "orderDate": "2023-11-22T01:55:58.792492Z", }, { "orderDate": "2023-12-22T01:55:58.792492Z", }, { "orderDate": "2023-11-22T04:55:58.792492Z", }, { "orderDate": "2023-11-22T05:55:58.792492Z", }, { "orderDate": "2023-11-22T01:55:58.792492Z", }, { "orderDate": "2023-12-22T01:55:58.792492Z", } ]
Tests:
lodash orderby
var array = ['all', 'market', 'stop']; var activeTab = array[Math.floor(Math.random() * array.length)]; var res = _.orderBy( [ ...(['all', 'orders'].includes(activeTab) ? orders : []), ...(['all', 'marker'].includes(activeTab) ? markers : []), ...(['all', 'stop'].includes(activeTab) ? stops : []), ], 'orderDate', 'desc' ); res.length;
native sort
var array = ['all', 'market', 'stop']; var activeTab = array[Math.floor(Math.random() * array.length)]; var filteredOrders = []; if (activeTab === 'all') { filteredOrders = filteredOrders.concat(orders).concat(markers).concat(stops); } else if (activeTab === 'market') { filteredOrders = filteredOrders.concat(markers); } else if (activeTab === 'stop') { filteredOrders = filteredOrders.concat(stops); } var res = _.orderBy(filteredOrders, 'orderDate', 'desc' ); res.length;
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
lodash orderby
native sort
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
2 years ago
)
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36
Browser/OS:
Chrome 121 on Mac OS X 10.15.7
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
lodash orderby
329450.1 Ops/sec
native sort
282959.0 Ops/sec
Autogenerated LLM Summary
(model
llama3.2:3b
, generated one year ago):
To answer this question accurately, we need to parse the benchmark results and runtimes for both the `lodash orderBy` function and native sorting. **Benchmark Results:** ```json [ { "Test Name": "lodash orderby", "RawUAString": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36", "Browser": "Chrome 121", "DevicePlatform": "Desktop", "OperatingSystem": "Mac OS X 10.15.7", "ExecutionsPerSecond": 329450.0625 }, { "Test Name": "native sort", "RawUAString": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36", "Browser": "Chrome 121", "DevicePlatform": "Desktop", "OperatingSystem": "Mac OS X 10.15.7", "ExecutionsPerSecond": 282959.0 } ] ``` **Analysis:** The benchmark results show that the `lodash orderBy` function executed approximately 115 times faster than native sorting, with a runtime of 329450 executions per second compared to 282959 executions per second. In terms of absolute values, we can estimate the execution time for each test as follows: * `lodash orderby`: 1 / 329450 ≈ 3.05 × 10^−6 seconds * native sort: 1 / 282959 ≈ 3.52 × 10^−6 seconds This suggests that `lodash orderBy` is approximately 15% faster than native sorting. **Conclusion:** The latest benchmark result indicates that the `lodash orderBy` function outperforms native sorting by a margin of around 15%. However, please note that this analysis assumes that the benchmark results are representative and accurate. In practice, performance differences may vary depending on specific use cases and system configurations.
Related benchmarks:
_.sortBy vs native sort
lodash vs es6 in sort method
iso date string sort comparison
order desc with lodash orderBy vs es6 sort method
ISO 8601 parsing
Comments
Confirm delete:
Do you really want to delete benchmark?