is object - native versus lodash

Benchmark created on


Preparation HTML

<script src="https://cdn.jsdelivr.net/lodash/4.17.4/lodash.min.js"></script>

Setup

var arr = [];
  for (var i = 0; i < 10000; i++) {
    arr.push({});
  }

Test runner

Ready to run.

Testing in
TestOps/sec
native
for (var i = 0; i < 10000; i++) {
  var result = arr[i] !== null && typeof arr[i] === 'object';
}
ready
lodash
for (var i = 0; i < 10000; i++) {
  var result = _.isObject(arr[i]);
}
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.