Skip to content
This repository was archived by the owner on Sep 8, 2020. It is now read-only.

Perf Improvement: don't digest after the $timeout. #292

Merged
merged 1 commit into from
Nov 8, 2014

Conversation

BrianGenisio
Copy link
Contributor

As far as I can tell, the $timeout in the directive does not actually modify any code that would require a $digest, although $timeout automatically calls digest at the end of the function.

This causes unnecessary digests to happen too frequently on startup (when I have several ui-sortable directives), affecting my startup performance.

It seems to work to call $timeout(callbac, 0, false) which forgoes the $digest but everything still works.

I there any reason that this won't work in your link function?

@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling 0316932 on BrianGenisio:master into 37c11b9 on angular-ui:master.

@thgreasi
Copy link
Contributor

thgreasi commented Nov 7, 2014

Gratz for finding this. 👍
We could also replace it with a simple timeout, but I prefer being able to use $timeout.flush() in my tests.

@thgreasi
Copy link
Contributor

thgreasi commented Nov 7, 2014

Also, possibly fixes/improves #288.

thgreasi added a commit that referenced this pull request Nov 8, 2014
feat(sortable): remove digest from $timeout on sortable('refresh')
@thgreasi thgreasi merged commit aedb58f into angular-ui:master Nov 8, 2014
@thgreasi
Copy link
Contributor

thgreasi commented Nov 8, 2014

Thanks for spotting this.
Will be in v1.13.1

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants