-
-
Notifications
You must be signed in to change notification settings - Fork 495
perf(): Remove inside onChange event #229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Current coverage is
|
OK now I understand the issue. :) I think I'll also remove the |
@@ -817,9 +817,7 @@ | |||
callOnChange: function() { | |||
if (this.options.onChange) { | |||
var self = this; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to make it perfect, could you remove this line and call onChange
directly on this? (When it's done, don't forget to rebase so there is one commit) ;)
When the callback run while changing the slider takes a certain amount of time (~50 ms or more), the inside onChange can stall resulting in many changes lost along the way while it catches up. Removing seems to have no visible side effects. It might be possible that this is due to scope.() being called right before callOnChange(), so the model is updated anyway (see in applyModel)
f122b5e
to
6ca68cb
Compare
Ok, done! |
Great thanks. |
perf(): Remove $timeout call inside onChange event
I just rollback your changes to the callback logic because I found the reason why we needed to wrap them in a $timeout call: if the user was changing one of its scope values in the callback function, then its changed wouldn't be applied. In the new version, I replaced the previous $timeout calls by $evalAsync one. See you example with the latest version: http://jsfiddle.net/zb33necv/ . Everything seems OK to me. |
I see, will the performance be the same, though? On Sun, Jan 24, 2016 at 1:00 PM, Valentin Hervieu [email protected]
|
If I understand correctly how it works, with $evalAsync, if there is already a digest in progress then it will be executed in it, otherwise it will program a new one. |
Indeed it seems to be ok. I tried again with my same sample and there's no On Tue, Jan 26, 2016 at 9:07 AM, Valentin Hervieu [email protected]
|
When the callback run while changing the slider takes a certain amount of time (~50 ms or more), the
inside onChange can stall resulting in many changes lost along the way while it catches up.
Removing seems to have no visible side effects. It might be possible that this is due to
scope.() being called right before callOnChange(), so the model is updated anyway (see in
applyModel)
See:
http://jsfiddle.net/c8po9y58/3/
Move the slider like crazy and watch the console output, you will see no stalling. To compare use the master version:
http://jsfiddle.net/3bfnocrb/1/