Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
sortWith (custom impl vs ramda) #2
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Android 13; Mobile; rv:121.0) Gecko/121.0 Firefox/121.0
Browser:
Firefox Mobile 121
Operating system:
Android
Device Platform:
Mobile
Date tested:
2 years ago
Test name
Executions per second
ramda sortWith
27.3 Ops/sec
custom impl
100.6 Ops/sec
HTML Preparation code:
<script src="//cdnjs.cloudflare.com/ajax/libs/ramda/0.25.0/ramda.min.js"></script>
Script Preparation code:
function prop(n,r){return void 0===r?r=>prop(n,r):r[n]}function ascend(n,r,t){if(1===arguments.length)return function(r,t){return ascend(n,r,t)};if(2===arguments.length)return function(t){return ascend(n,r,t)};var e=n(r),u=n(t);return e<u?-1:e>u?1:0}function descend(n,r,t){if(1===arguments.length)return function(r,t){return descend(n,r,t)};if(2===arguments.length)return function(t){return descend(n,r,t)};var e=n(r),u=n(t);return e>u?-1:e<u?1:0}function sortWith(r,t){if(1===arguments.length)return function(t){return sortWith(r,t)};var n=r.length;return Array.prototype.slice.call(t,0).sort(function(t,o){for(var e=0,i=0;0===e&&i<n;i++)e=r[i](t,o);return e})} var data = [...Array(3000)].map((v, idx) => { return { value: parseInt(Math.random() * 100, 10), age: parseInt(Math.random() * 100, 10) } }); var valueNameSortR = R.sortWith([ R.descend(R.prop('age')), R.ascend(R.prop('value')) ]); var valueNameSort = sortWith([ descend(prop('age')), ascend(prop('value')) ]);
Tests:
ramda sortWith
valueNameSortR(data)
custom impl
valueNameSort(data)