Angular IsObject x Javascipt TypeOf Object

Benchmark created by Marcio on


Description

Check performance between Angular.isObject and Typeof 'object'.

Preparation HTML

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.18/angular.min.js">
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
Typeof Object
var v = {};
var val = 0;
for (var i = 0; i < 1000; i++) {
  if (typeof v === 'object') {
    val++;
  }
}
ready
Angular.isObject
var v = {};
var val = 0;
for (var i = 0; i < 1000; i++) {
  if (angular.isObject(v)) {
    val++;
  }
}
ready

Revisions

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