-
-
Notifications
You must be signed in to change notification settings - Fork 988
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
Slow FlatList render when list item contains Swipeable #3344
Comments
I looked into this issue, this seems to be a separate problem than both #3307 and #3141. It seems the very first I'll look into this issue more. |
Thanks for taking a look, much appreciated. Thank you also the pointers to #3307 and #3141, I've had a look at those two issues and @latekvo may be right in saying it's different. If I undrestand correctly, in these issues it's the rendering when scrolling, rather than initial load, which seems to be highlighted? I guess scrolling also causes items to render so it may still be the same issue (my list doesn't have enough items to extend outside the window). Looking at the videos in #3141 if feels like the initial render is smooth (which is not the case for me) and the issue arises when scrolling outside the window. |
In my case it's the initial load and unmounting that takes at least x3 times more time with |
Hey, we've looked into this issue and narrowed down the majority of this issue to We'll take a look at the remaining 32% separately, but as of now, the I've forwarded the |
Description
I'm seeing a significant slowdown in rendering when I add a
Swipeable
to the items in a FlatList.This visually looks about 2x slower on my Androids (emulator, old device, newer device). iOS is less noticeable (iPhone 11) but from what I've profiled it looks like iOS is also slowing down.
By eye it looks like my screen takes ~2s to render on my newer device (~3s on the older device/emulator) with
Swipeable
present but ~0.5s (~1s on the older device/emulator) when I delete theSwipeable
.I've tried to create a Snack, but it seems to be using Expo 51 and I'm seeing this in Expo 52 with New Architecture. I've still given the link to the Snack below just in case this is helpful.
Steps to reproduce
I wanted to provide as useful an issue as I can in the hope this is helpful, so I've done my best to optimise and strip down my code (see below) and then profiled performance when the
Swipeable
component is present and, for comparison, when I delete it.I've optimised what I can in my code (
memo
anduseCallback
) and stripped it back in case it's something else I'm doing. I'm including the code below.I then used the profiler to see where the slowdown is coming from.
Swipeable
seems to be taking a chunk of time on each item. I'm including screenshots and exported profile data. I've highlighted theVirtualizedList
component with a red dot in the screenshots for visual comparison. The trace highlihtsSwipeable
in yellow for items rendered.Performance profiles:
With Swipeable
swipeable-profiling-data.17-01-2025.22-03-28.json
Without Swipeable
no-swipeable-profiling-data.17-01-2025.22-08-42.json
Code
Stripped back as much as possible to make it easier to reproduce if needed.
The
Swipeable
is the outermost component of theSearchResult
list item. Deleting theSwipeable
significantly reduces rendering time, particularly noticeable on Android, especially an older real device I'm testing with:Snack or a link to a repository
https://snack.expo.dev/@davidcarboni/swipeable-performance
Gesture Handler version
~2.20.2
React Native version
0.76.6
Platforms
Android, iOS
JavaScript runtime
Hermes
Workflow
Expo managed workflow
Architecture
Fabric (New Architecture)
Build type
Debug mode
Device
Real device
Device model
OnePlus 9, OnePlus 5 (also Android Emulator and iPhone 11)
Acknowledgements
Yes
The text was updated successfully, but these errors were encountered: