Angular IsFunction x Javascipt TypeOf Function (v2)

Revision 2 of this benchmark created on


Description

Check performance between Angular.isFunction and Typeof 'function'.

Preparation HTML

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.18/angular.min.js">
</script>
<script>
var f = {name:'alibaba', age:88888};
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
Typeof Function
var val = 0;
for (var i = 0; i < 1000; i++) {
  if (typeof f === 'object' && f !== null) {
    val++;
  }
}
ready
Angular.isFunction
var val = 0;
for (var i = 0; i < 1000; i++) {
  if (angular.isObject(f)) {
    val++;
  }
}
ready

Revisions

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