Android SDK - RecyclerView Sluggish After Adding SDK
I added the SDK to our application.
I'm doing the setup (Optimizely.startOptimizely) in the Activity's onCreate and have created on OptimizelyCodeBlock with a default and three branches.
After adding the SDK, I noticed that the scroll speed of our RecyclerView is really sluggish. Are you tracking events while scrolling that could cause this?
I had two goals setup that used a touch event that is triggered while scrolling. I have since removed this from the experiment (via online editor) and any branching code is also removed (from the app). I only have the startOptimizely/OptimizelyCodeBlock code left yet the scroll performance is still bad.
As an experiment I build the app without any Optimizely code and the performance is normal.
Before I dig in as to what the problem might be, are you aware of anything that could cause RecylerView scroll perfromance to be impacted?
Solved! Go to Solution.
The Optimizely SDK uses a ViewTreeObserver to identify views that maybe have been modified via the visual editor or may have tap goals. Scrolling a RecyclerView can cause many calls to the ViewTreeObserver especially if the individual rows are complex. We're working on optimizing performance, but if you want a quick work-around, you can disable all view tracking: by calling Optimizely.setVisualExperimentsEnabled(false);
Definitely look out for improvements in this space!
Also I guess one should keep in mind that it needs to be enabled during development in order to use the Editor to set up the codeBlocks as well as during testing/verification of codeBlocks but needs to be disabled before going to prod.