Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Compare lodash isEmpty and length comparison on string arrays
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Android 15; Mobile; rv:148.0) Gecko/148.0 Firefox/148.0
Browser:
Firefox Mobile 148
Operating system:
Android
Device Platform:
Mobile
Date tested:
one month ago
Test name
Executions per second
isEmpty empty array
3125607.2 Ops/sec
length empty array
2302425.5 Ops/sec
isEmpty array of strings
3014258.0 Ops/sec
length array of strings
2255338.8 Ops/sec
HTML Preparation code:
<script src="https://cdn.jsdelivr.net/npm/lodash@4.17.4/lodash.min.js"></script>
Script Preparation code:
// empty array window.foo1 = []; // array of strings window.foo2 = ['a', 'b', 'c', 'd', 'e'];
Tests:
isEmpty empty array
_.isEmpty(window.foo1);
length empty array
(Array.isArray(window.foo1) && window.foo1.length === 0);
isEmpty array of strings
_.isEmpty(window.foo2);
length array of strings
(Array.isArray(window.foo2) && window.foo2.length === 0);