Skip to content

Instantly share code, notes, and snippets.

@badsyntax
Created June 22, 2015 19:35
Show Gist options
  • Select an option

  • Save badsyntax/6746495d7285f5cf6b56 to your computer and use it in GitHub Desktop.

Select an option

Save badsyntax/6746495d7285f5cf6b56 to your computer and use it in GitHub Desktop.
benchmark $rootScope.$digest
var scopePrototype = Object.getPrototypeOf($rootScope);
var oldDigest = scopePrototype.$digest;
scopePrototype.$digest = function() {
var start = window.performance.now();
oldDigest.apply(this, arguments);
var end = window.performance.now();
var totalTime = end - start;
if (totalTime > 400) {
window.console.warn('Long running digest cycle detected! %dms', totalTime);
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment