var app = angular.module('parsedExpressionBenchmark', []); app.config(function($compileProvider) { if ($compileProvider.debugInfoEnabled) { $compileProvider.debugInfoEnabled(false); } }); app.filter('noop', function() { return function(input) { return input; }; }); //Executes the specified expression as a watcher app.directive('bmPeWatch', function() { return { restrict: 'A', compile: function($element, $attrs) { $element.text( $attrs.bmPeWatch ); return function($scope, $element, $attrs) { $scope.$watch($attrs.bmPeWatch, function(val) { $element.text(val); }); }; } }; }); //Executes the specified expression as a watcher //Adds a simple wrapper method to allow use of $watch instead of $watchCollection app.directive('bmPeWatchLiteral', function($parse) { function retZero() { return 0; } return { restrict: 'A', compile: function($element, $attrs) { $element.text( $attrs.bmPeWatchLiteral ); return function($scope, $element, $attrs) { $scope.$watch( $parse($attrs.bmPeWatchLiteral, retZero) ); }; } }; }); app.controller('DataController', function($scope, $rootScope) { var totalRows = 10000; var data = $scope.data = []; var star = '*'; $scope.func = function() { return star;}; for (var i=0; i