Last active
January 18, 2017 05:35
-
-
Save rosston/bd08bb1e9687b7883fb3 to your computer and use it in GitHub Desktop.
Angular digest performance
This file contains 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
// Simple, single run | |
(function() {var body = angular.element('body'); var start = Date.now(); body.scope().$apply(); console.log((Date.now() - start) + 'ms digest');})(); | |
// Average of 50 | |
(function() { var body = angular.element('body'); var numRuns = 50; var totalRunTime = 0; for (var i = 0; i < numRuns; i++) { var start = Date.now(); body.scope().$apply(); totalRunTime += Date.now() - start; } console.log((totalRunTime / numRuns) + 'ms average over ' + numRuns + ' digests'); })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment