-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
ScrollView: investigate expensive layout measurements #473
Comments
I'm running some profiling to try to narrow it down... |
Maybe some tips so my component measure layouts faster? |
Maybe there's a way to improve performance by using Element.getBoundingClientRect() |
Are you using the If you're using styled-components with RN/RNW that is also likely to be very slow and wasteful. |
@brunolemos Is your ListView deeply nested within your app? |
@RangerMauve yes, it's trello-like |
The Regardless, this means that ListViews are a huge performance issue if they're not near the root of your DOM, and more generally |
Found out something (kinda obvious but might help). The ListView is initially rendering 10 item. If I set |
Yeah the |
I've done a benchmark of |
o_O |
Haha I was also shocked as I was expecting it to be faster for sure. Thought it would be quick win but nope... And I'm kind of confused why as everything that I know suggests that it should be faster... But hey if it doesn't work then it doesn't work. Thought I'd loop back here to say that it's also not more performant. |
Can you let me know if #490 solves some of this for you? |
Might still be worth using |
@brunolemos Yeah, I had a similar problem. I also hacked React.createElement so that it would execute any stateless functions as functions if they didn't need to be components for stuff like context |
@brunolemos |
@aFarkas you can see it running here: http://brunolemos.github.io/devhub/
I didn't make the code public yet neither shared the project with anyone. |
I rewrote my app from scratch and I don't have this issue anymore. Performance is great. As I didn't isolate the issue, I don't know the real cause of it, but one of the changes was that I removed styled-components and took extra care to avoid unnecessary re-renders. |
Thanks for following up! |
What is the current behavior?
When scrolling, there is a huge lag.
Chrome shows some warnings on console that could help find the issue.
Most violations point to UIManager measureLayout), the last one to a debounce function:
Steps to reproduce
Tried to create a minimal test case on codepen but could not. Maybe it's because my component tree is relatively deep and heavy styled (ps: using styled-components). Added you to the repository so you can run it. PS: On mobile, works fine. Bad performance only on web.
Environment (include versions)
OS: macOS 10.12.4
Device: Macbook Pro 2016
Browser: Chrome 58.0
React (version): 16.0.0-alpha.6
React DOM (version): 15.5.4 (react-native-web does not support >= 16)
React Native (version): 0.43.2
React Native for Web (version): 0.0.94
The text was updated successfully, but these errors were encountered: