Angular IsFunction x Javascipt TypeOf Function

Benchmark created by Marcio 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>
function f(){}
</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 === 'function') {
    val++;
  }
}
ready
Angular.isFunction
var val = 0;
for (var i = 0; i < 1000; i++) {
  if (angular.isFunction(f)) {
    val++;
  }
}
ready

Revisions

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