-
Notifications
You must be signed in to change notification settings - Fork 107
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
isElementVisible performance #220
Comments
@priandsf First of all, thank you for the issue and your investigation! I knew that someday our visibility-watcher could play a trick on the ui-scroll performance. Unfortunately, your suggestion (remove In general, I agree with you, that the fastest solution is to turn the entire feature off by some new external option (say,
with
This condition will control all possible PS |
Thanks for you reply Denis. And you're correct, the culprit is I've been playing with the library a bit, trying to understand its internals. It takes some time to dive within its intimate implementation, so I feel like a sorcerer's apprentice. In particular, I'm not sure about all the use cases it supports. Nevertheless, I experimented with a new fixed
All of that helped a lot from a performance standpoint. The reflow don't happen anymore, and the scroll is way smoother because it doesn't trigger $digest during the scroll unless it needs to load rows. So far it seems to work with our screens. I also commented out the $digest in processUpdates() when there is a fixed row height. It also helped from a performance standpoint and seems to work as well. Not sure if I've done too much here or not... If you want to have a look, I pushed the code to this branch: https://github.com/priandsf/ui-scroll/tree/Added-static-row-height |
@priandsf You are doing great job! I opened PR and we'll be able to continue discussion within the PR as it might be much more convenient. Also, may I ask you to add me to your fork's collaborator list as I want to push commits along with you? |
Sure - Just did it. I meant to have done that earlier... :-) |
The rows we are displaying are complex and thus the digest cycles are pretty expensive. By profiling some of the code, we figured out that isElementVisible triggers many browser style recalculations (forced reflow), see the attached picture. When I changed the isElementVisible like bellow:
then it suddenly became more efficient. From what I understand, this is for the rows that have an initial height of 0, but in our case all the rows always have the same fixed height, and are never hidden.
I'll be happy to submit a pull request with a parameter that prevents this check, but I would like to know what form it can have. For example, we can have a rowheight attribute that sets a fixed value for the row height. If so, and if we use this attribute during calculations, can this be used to reduce the manual calls to $digest, like in processUpdates or resizeAndScrollHandler? In the later, I'm not sure what a $digest needs to be triggered, particularly if no rows have been inserted/deleted. But I might be missing something :-)
The text was updated successfully, but these errors were encountered: