Skip to content

Instantly share code, notes, and snippets.

@pevers
Last active August 29, 2015 14:21
Show Gist options
  • Save pevers/5b16a0892f3e5e07e397 to your computer and use it in GitHub Desktop.
Save pevers/5b16a0892f3e5e07e397 to your computer and use it in GitHub Desktop.
Angular ng-repeat benchmark
(function (_g, angular) {
'use strict';
angular.module(_g.name)
.directive('measureTime', ['$timeout',
function($timeout) {
return {
restrict: 'EA',
link: function(scope, element, attrs) {
if (scope.$first) {
console.time(attrs.measureTime);
}
if (scope.$last) {
$timeout(function() {
console.timeEnd(attrs.measureTime);
});
}
}
};
}]);
}(window.__globals, window.angular));
<div measure-time="myTimer"></div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment