I have a fragment containing a RecyclerView within a ViewPager, which works fine the first time I enter the page. However, after switching back and forth between ViewPager pages multiple times, the RecyclerView starts to lag.

Upon analyzing a perfetto-trace file, I noticed that during scrolling, each frame calls the syncFrameState function, leading to a large number of textureUpload calls and causing the lag. I'm puzzled by why texture uploads are happening in every frame. Shouldn't they be cached to improve performance?"

trace_file_bad

Link of Perfetto trace file.

When is the 'textureUpload' function intended to be called, and how can I ensure that the 'drawFrame' call dequeues buffers similar to how it's done in other pages?

0

There are 0 best solutions below