Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
_.pickBy vs native vs ES6 Filter
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36
Browser:
Chrome 137
Operating system:
Linux
Device Platform:
Desktop
Date tested:
10 months ago
Test name
Executions per second
Lodash pickBy
16721.5 Ops/sec
Native Filter
41455.7 Ops/sec
ES6 Filter
64139.5 Ops/sec
Script Preparation code:
var obj = {}; for (let i = 0; i < 1000; i++) { const randomNum = Math.floor(Math.random() * 4); obj[i.toString()] = randomNum === 0 ? "undefined" : randomNum === 1 ? false : true; }
Tests:
Lodash pickBy
_.pickBy(obj);
Native Filter
function pickBy(object) { const obj = {}; for (const key in object) { if (object[key]) { obj[key] = object[key]; } } return obj; } pickBy(obj)
ES6 Filter
Object.keys(obj).filter(key => { if (obj[key]) return obj[key] })