AngularJS Controllers Insance Performance

Benchmark created by Ivan Pacheco on


Preparation HTML

<!doctype html>

<html x-ng-app="test">

<head>
    <meta charset="utf-8" />
    <title>Controller Instances</title>
</head>

<body>
    <div x-ng-controller="TestController">
        {{message}}
    </div>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
</body>

</html>

Setup

(function wrapper() {
    angular.module('test', []);
    })();

Test runner

Ready to run.

Testing in
TestOps/sec
Classic Mode
(function wrapper(){
angular
    .module('test')
    .controller('TestController', ['$http', '$location', '$scope', function($http, $location, $scope) {
    $scope.message = 'Hey, cruel world...';
}]);
})();
ready
Prototype Mode
(function wrapper(){
function TestController($http, $location, $scope) {
    $scope.message = 'Hey, cruel world...';
}
TestController.$inject = ['$http', '$location', '$scope'];

angular
    .module('test')
    .controller('TestController', TestController);
})();
ready

Revisions

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

  • Revision 1: published by Ivan Pacheco on
  • Revision 2: published by angularClick on
  • Revision 3: published by angularClick on
  • Revision 4: published by angularClick on