Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
find by id and replace in array [lodash vs js vs ramda]
find by id and replace in array [lodash vs js vs ramda]
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (iPhone; CPU iPhone OS 18_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/135.0.7049.83 Mobile/15E148 Safari/604.1
Browser:
Chrome Mobile iOS 135
Operating system:
iOS 18.4.1
Device Platform:
Mobile
Date tested:
one year ago
es6 map
66.7M/s
lodash findIndex and splice
12.0M/s
ramda map
11.4M/s
ramda findIndex and splice
2.2M/s
lodash map
1.4M/s
View exact numbers
Test name
Executions per second
✓
es6 map
66,652,392 Ops/sec
lodash findIndex and splice
12,012,352 Ops/sec
ramda map
11,404,394 Ops/sec
ramda findIndex and splice
2,161,418 Ops/sec
lodash map
1,420,234 Ops/sec
HTML Preparation code:
<script src="//cdnjs.cloudflare.com/ajax/libs/ramda/0.25.0/ramda.min.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/lodash-fp/0.10.4/lodash-fp.min.js"></script>
Script Preparation code:
var arr = [{id: 1, name: "Person 1"}, {id: 2, name: "Person 2"}];
Tests:
lodash map
var newArr = _.map(arr, function(a) { return a.id === 1 ? {id: 1, name: "Person New Name"} : a; });
es6 map
// ES6 var newArr = arr.map(function(a) { return a.id === 1 ? {id: 1, name: "Person New Name"} : a; });
lodash findIndex and splice
var index = _.findIndex(arr, {id: 1}); // Replace item at index using native splice arr.splice(index, 1, {id: 100, name: 'Person New Name'});
ramda findIndex and splice
const index = R.findIndex(R.propEq('id', 1))(arr) arr.splice(index, 1, {id: 100, name: 'Person New Name'});
ramda map
var newArr = R.map(function(a) { return a.id === 1 ? {id: 1, name: "Person New Name"} : a; })(arr);