dohooo / react-native-reanimated-carousel

🎠 React Native swiper/carousel component, fully implemented using reanimated v2, support to iOS/Android/Web. (Swiper/Carousel)
https://react-native-reanimated-carousel.vercel.app
MIT License
2.73k stars 317 forks source link

Loading times and memory usage are too high #559

Open MarcosHY opened 6 months ago

MarcosHY commented 6 months ago

--- Is your feature request related to a problem? Please describe. I am using this library to show downloaded images from the internet and stored in /storage/emulated/0/Android/data/com.appname/files. If the images are less than 1mb they work mostly fine, but on images of 3-15mb it is taking a lot of time to show, and with 5-10 seconds of autoPlay they don't even appear sometimes.

Another issue is that having around 7 images to add to the carousel the memory usage according to the AndroidStudio Profiler went from 280mb to 1,7gb more or less which caused the app to crash. I have started to use windowSize to 2 and 3 and it tops at 800mb now, which is still a lot.

--- Describe the solution you'd like Render the images where they all appear much faster so there are no empty spaces in the slides, and memory optimisation where it doesn't increase by 500mb or 1gb when loading them.

--- Describe alternatives you've considered Using windowSize and it works for the memory usage although it is still quite high, but the loading issues are still there.

--- Additional context Versions used:

    "react-native-gesture-handler": "^2.15.0",
    "react-native-reanimated": "^3.7.2",
    "react-native-reanimated-carousel": "^3.5.1",

Here are screenshots of the Android Studio Profiler. The app is also playing other videos in high res or displaying other static images, but that barely affects the memory. The spikes are when a carousel appears and is snapping to the next items.


Screen Shot 2024-03-07 at 12 23 39

Screen Shot 2024-03-06 at 13 53 53


Screen Shot 2024-03-06 at 13 34 25 Screen Shot 2024-03-06 at 13 39 34
MarcosHY commented 6 months ago

I have "solved" it by installing react-native-fast-image. The first time the images are shown it still goes high in memory, but the following times it barely changes and is around the 300-400mb mark.

Screen Shot 2024-03-13 at 19 48 28