Skip to content

Instantly share code, notes, and snippets.

@gdpelican
Created October 5, 2016 23:04
Show Gist options
  • Save gdpelican/80c2226930e80046c7dd1e87837f8e3b to your computer and use it in GitHub Desktop.
Save gdpelican/80c2226930e80046c7dd1e87837f8e3b to your computer and use it in GitHub Desktop.
running = false
$rootScope.$watch ->
return if running
running = true
console.time('digestLoop')
$rootScope.$$postDigest ->
console.timeEnd('digestLoop')
running = false
@gdpelican
Copy link
Author

This will log the length of each digest loop to the console. Sample output:

app.js:49 digestLoop: 277.806ms
app.js:49 digestLoop: 16.449ms
app.js:49 digestLoop: 1.276ms
app.js:49 digestLoop: 1.015ms
app.js:49 digestLoop: 8.558ms
app.js:49 digestLoop: 448.557ms

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment