-
Notifications
You must be signed in to change notification settings - Fork 107
huge performance issues #45
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
Comments
Submit a pull request. This call to $apply is a throwback from the time when in certain use cases there was no calls to timeout. Another thing I keep going back to is to disable scroll handler for as long as there are pending requests |
I'd like to submit a pull request, but the problem is that I haven't written in coffee quite a lot of time so I'm not sure about it. |
After a batch of elemens is instantiated, the decision whether more elements are needed or scroller has enough to fill the viewport) is based on the dimensions and positions of the instantiated elements. And this information is only becomes available after the elements are fully instantiated. |
Agree. But still didn't get the idea why we need to constantly run digest cycles when scrolling |
We do not. We just need to cover the entire span the scrolling went through. I think it makes sense to ignore scrolling events after the first one fired. The problem is when to re subscribe. I am playing with the idea of waiting for all pending requests to complete and re subscribe after that. It will not eliminate all redundant requests, but, I hope, will reduce the number of them. And this redundunat scope.$apply definitely should be removed, although I need to double check for edge cases |
Hi, var postponed = null;
resizeAndScrollHandler = function() {
clearTimeout(postponed);
postponed = setTimeout(proceed, 100);
function proceed () {
if (!$rootScope.$$phase && !adapter.isLoading) {
adjustBuffer();
return $scope.$apply();
}
}
}; |
@aantipov I've double checked and commited your redundant digest call fix, thank you. @nestak It's an interesting idea but there are some potentialy bad points I see. 1st is that this delta (100ms) affects the UI response. 2nd is that the size of this delta is empirical data -- if you make it too small then scroll events will be fired in-between user' scrollings -- and I guess it also may depends on browser' realization... anyway this idea requires additional research... thanks! |
you commited it to |
yeah, thanks for this note; i've recommited this fix; it includes also a simple test fix |
Cool! |
I have committed a potential fix for the performance issues by attaching the check to an interval running every 100 milliseconds instead of on the scroll event (about every 6-10 milliseconds). |
As for me - the decision looks fine. I just added several notes to the PR. But we do need to test it thoroughly. Anyway, we need to hear a word from @mfeingold and @dhilt |
fixed in #66 |
Hi
Currently my app experiences big performance issues when scrolling through the list of items.
Having done some investigation I found out that each scroll event causes 2 digest cycles!!!
Taking into account that each digest cycle runs a lot of watchers (~1000) we are getting an unresponsive app.
It's a very bad idea by itself to do anything on every scroll event, even John Resig long time ago warned against using it http://ejohn.org/blog/learning-from-twitter/
But I wonder why do we need to run digest cycles at all when scrolling?
BTW, I found the way to get rid at list of one redundant digest call.
Look at this function
$scope.$apply();
call here is redundant becauseadjustBuffer()
calls$timeout
function, which in its turn calls$scope.$apply();
. So we can get rid of$scope.$apply()
in the code above.The text was updated successfully, but these errors were encountered: