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 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36
Browser:
Chrome 125
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
2 years ago
es6 map
22.7M/s
ramda map
6.6M/s
lodash findIndex and splice
5.1M/s
ramda findIndex and splice
2.6M/s
lodash map
1.4M/s
View exact numbers
Test name
Executions per second
✓
es6 map
22,673,766 Ops/sec
ramda map
6,611,170 Ops/sec
lodash findIndex and splice
5,142,318 Ops/sec
ramda findIndex and splice
2,592,164 Ops/sec
lodash map
1,385,074 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);