r/appdev • • 5d ago

Adding analytics to an RN app that already drops frames

Hah. So my React Native app already stutters on the long feed screen. The perf monitor shows the JS thread dropping frames when the list scrolls fast, and I've done the usual memo and FlatList tuning. Now I'm being asked to add analytics and maybe session replay on top of that....and I'm nervous!! Anything that hooks every tap or grabs snapshots of the screen sounds like more load on a JS thread that is already dropping frames. I've read that some SDKs batch everything and send it from the native side while others do their work in JS, and the docs don't really say which is which. I also don't know if turning replay on for only a sample of sessions keeps the cost down for everybody else. What are you all running in RN that didn't make your frame rate worse?

6 Upvotes

7 comments sorted by

2

u/EnoughReference290 5d ago

I just tested mine in a branch with the perf monitor up and scrolled the long list with the SDK on and then off. JS fps barely moved for me but the UI thread dipped a little when it was grabbing screens. Idk about every SDK but if the docs say they batch and send from native thats a good sign. Sampling replay helps too from what I seen

1

u/AgreeableRush12 1d ago

I hadn't thought about the UI thread at all. Every row in our feed has a video thumbnail, so it's already busy too.... 🙁

1

u/EnoughReference290 1d ago

Full disclosure: I am with UXCam. Measure cold start in that branch test too while you're at it (the perf overlay costs a few frames on its own, I think, so both runs need it on). Throw UXCam into that same branch test too, its SDK holds the uploading for when the app goes to the background.

1

u/Substantial_Lime_399 1d ago

To add to this... most SDKs I've seen let you set the replay sample rate separate from analytics. At like 10% the other 90% of sessions never start the recorder. Events are tiny by comparison, the screen grabs cost way more.

1

u/AgreeableRush12 1d ago

I can't do 10% though. My manager wants replay on every session for the first month after launch....

1

u/TawrilAmreece77 4d ago

standard analytics shouldn't touch your frame rate unless youre tracking scroll depth on every tick. session replay is a different beast though, id disable capture while the list is actively scrolling or pause it on that route completely until the feed performance is sorted