Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
isEmpty (forIn vs Object.keys vs Object.values vs lodash.isEmpty)
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/20100101 Firefox/128.0
Browser:
Firefox 128
Operating system:
Windows
Device Platform:
Desktop
Date tested:
10 months ago
Test name
Executions per second
forIn
130009.5 Ops/sec
lodash
381082.0 Ops/sec
objectKeys
425605.7 Ops/sec
objectValues
727337.7 Ops/sec
HTML Preparation code:
<script src='https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.5/lodash.min.js'></script>
Script Preparation code:
window.emptyArray = []; window.emptyObject = {}; window.emptyString = ''; window.filledArray = []; window.filledObject = {}; window.filledString = ''; Array.from((Array(100).keys())) .forEach((result, i) => { filledArray.push(0); filledObject[i] = 0; filledString[i] += '0'; }); window.forIn = source => { for(var prop in source) { return false; } return true; }; window.lodash = _.isEmpty; window.objectKeys = source => Object.keys(source).length === 0; window.objectValues = source => Object.values(source).length === 0;
Tests:
forIn
forIn(emptyArray); forIn(emptyObject); forIn(emptyString); forIn(filledArray); forIn(filledObject); forIn(filledString);
lodash
lodash(emptyArray); lodash(emptyObject); lodash(emptyString); lodash(filledArray); lodash(filledObject); lodash(filledString);
objectKeys
objectKeys(emptyArray); objectKeys(emptyObject); objectKeys(emptyString); objectKeys(filledArray); objectKeys(filledObject); objectKeys(filledString);
objectValues
objectValues(emptyArray); objectValues(emptyObject); objectValues(emptyString); objectValues(filledArray); objectValues(filledObject); objectValues(filledString);