Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

chore($scope): Short-circuit after dirty-checking last dirty watcher #5272

Closed
wants to merge 1 commit into from

Conversation

kseamon
Copy link
Contributor

@kseamon kseamon commented Dec 4, 2013

chore($scope): Short-circuit after dirty-checking last dirty watcher

Stop dirty-checking during $digest after the last dirty watcher has been re-checked.
This prevents unneeded re-checking of the remaining watchers (They were already checked in the previous iteration), bringing a substantial performance improvement to the average case run time of $digest.

@mary-poppins
Copy link

Thanks for the PR!

  • Contributor signed CLA now or in the past
    • If you just signed, leave a comment here with your real name
  • PR's commit messages follow the commit message format

If you need to make changes to your pull request, you can update the commit with git commit --amend.
Then, update the pull request with git push -f.

Thanks again for your help!

@ghost ghost assigned IgorMinar Dec 4, 2013
@kseamon
Copy link
Contributor Author

kseamon commented Dec 4, 2013

I wasn't sure if it was preferable to use a closure variable for dirtyWatch or to add a new $$ member to $rootScope.

I went with a closure var, but it would be easy enough to change.

@IgorMinar
Copy link
Contributor

@kseamon closure var is better

@@ -416,6 +419,8 @@ function $RootScopeProvider(){
var internalObject = {};
var oldLength = 0;

dirtyWatch = null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$watchCollection uses $watch under the hood so this is not necessary

IgorMinar pushed a commit to IgorMinar/angular.js that referenced this pull request Dec 5, 2013
Stop dirty-checking during $digest after the last dirty watcher has been re-checked.
This prevents unneeded re-checking of the remaining watchers (They were already checked in the previous iteration), bringing a substantial performance improvement to the average case run time of $digest.

Closes angular#5272
@IgorMinar
Copy link
Contributor

this PR has been superseded by #5287. closing

@IgorMinar IgorMinar closed this Dec 5, 2013
IgorMinar pushed a commit that referenced this pull request Dec 5, 2013
Stop dirty-checking during $digest after the last dirty watcher has been re-checked.

This prevents unneeded re-checking of the remaining watchers (They were already
checked in the previous iteration), bringing a substantial performance improvement
to the average case run time of $digest.

Closes #5272
Closes #5287
jamesdaily pushed a commit to jamesdaily/angular.js that referenced this pull request Jan 27, 2014
Stop dirty-checking during $digest after the last dirty watcher has been re-checked.

This prevents unneeded re-checking of the remaining watchers (They were already
checked in the previous iteration), bringing a substantial performance improvement
to the average case run time of $digest.

Closes angular#5272
Closes angular#5287
jamesdaily pushed a commit to jamesdaily/angular.js that referenced this pull request Jan 27, 2014
Stop dirty-checking during $digest after the last dirty watcher has been re-checked.

This prevents unneeded re-checking of the remaining watchers (They were already
checked in the previous iteration), bringing a substantial performance improvement
to the average case run time of $digest.

Closes angular#5272
Closes angular#5287
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants