Created
June 22, 2015 19:35
-
-
Save badsyntax/6746495d7285f5cf6b56 to your computer and use it in GitHub Desktop.
benchmark $rootScope.$digest
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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