Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Native filter VS Lodash omit. Second attempt.
Comparing Native filter VS Lodash omit (2 ways)
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36 Edg/126.0.0.0
Browser:
Chrome 126
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
Native filter
2.3 Ops/sec
Lodash omit
1.8 Ops/sec
Lodash omit with function
0.1 Ops/sec
HTML Preparation code:
<script src="https://cdn.jsdelivr.net/npm/lodash@4.17.4/lodash.min.js"></script>
Script Preparation code:
var data = []; var omitedValues = []; var dataObject = {}; var max = 1000000; var limit = max / 2; for (let i = 0; i < max; i ++) { data.push({ id: i, name: `item_${i}` }); dataObject[i] = { id: i, name: `item_${i}`}; if (i < limit) { omitedValues.push(i.toString()); } } const filter = data.filt
Tests:
Native filter
const filter = data.filter(item => { const name_index = item.name.split('_')[1]; return parseInt(name_index, 10) < limit; });
Lodash omit
const omitData = _.omit(dataObject, omitedValues);
Lodash omit with function
const omitByData = _.omit(data, (value, key) => { const name_index = value.name.split('_')[1]; return parseInt(name_index, 10) > limit; });