Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Jank during scroll #4488

Closed
justasm opened this issue Mar 28, 2016 · 4 comments
Closed

Jank during scroll #4488

justasm opened this issue Mar 28, 2016 · 4 comments
Labels
Android Mapbox Maps SDK for Android performance Speed, stability, CPU usage, memory usage, or power usage

Comments

@justasm
Copy link
Contributor

justasm commented Mar 28, 2016

There is noticeable jank / stuttering when scrolling the map on Android, both when triggered by gesture and programmatically.

This can be observed with both debug and release builds of the test app as well as with the Mapbox Dev Preview app published on the Play Store.

Tested on Nexus 5, Samsung Galaxy S3 and Nexus 5X.

Note that this seems to be an issue specifically with the Android SDK. There is minimal to no observed jank during scrolling with the iOS test app on an iPhone 5.


It may be of interest that the issue is greatly reduced when using a MapView backed by SurfaceView (as opposed to the current implementation which uses TextureView).

A minimal sample that allows to quickly toggle between the two implementations and makes the jank during scrolling apparent can be found at justasm/mapbox-gl-native@19c528b

Some stats were calculated using the sample, a Nexus 5 running Android 6.0.1 Marshmallow and adb shell dumpsys gfxinfo.

Methodology:

  1. Load up respective version of the MapView using the linked sample.
  2. Tap the SCROLL button to programmatically scroll the map horizontally back and forth 3 times to ensure the map tiles have loaded.
  3. Reset the frame stats data using adb shell dumpsys gfxinfo com.mapbox.mapboxsdk.testapp reset.
  4. Tap the SCROLL button to programmatically scroll the map horizontally back and forth until a sufficient number of frames have been captured.
  5. Retrieve the frame stats using adb shell dumpsys gfxinfo com.mapbox.mapboxsdk.testapp framestats.

Results / observations:

  • Raw data.
  • Short video (not a great representation of the issue): TextureView vs SurfaceView.
  • Despite the appearance of jank, neither implementation has frame latency that exceeds 16ms.
  • The TextureView implementation has, on average, a lower (i.e. better) frame latency.
  • The SurfaceView implementation has a more stable frame latency.

TextureView- vs SurfaceView-backed MapView frame latency

@bleege bleege added the Android Mapbox Maps SDK for Android label Mar 28, 2016
@bleege
Copy link
Contributor

bleege commented Mar 31, 2016

@justasm This is great information. Thank you for putting the time and energy into researching this and documenting it. I'm CCing the team so that we can join your efforts to resolve this. Thanks again!

/cc @zugaldia @tobrun @jfirebaugh @tmpsantos @brunoabinader

@bleege bleege added the performance Speed, stability, CPU usage, memory usage, or power usage label Mar 31, 2016
@bleege
Copy link
Contributor

bleege commented Mar 31, 2016

Here's some context on why we switched to using TextureView last Fall.

@zugaldia
Copy link
Member

zugaldia commented Sep 22, 2016

@justasm Thank you so much again for this great report. We should extract the methodology that you describe here into a wiki page so that we can give it continuity and expand it over time.

Regarding the original point in OP, we're now shipping a SurfaceView implementation since v4.2.0-beta.2 (see #5000) that's bringing increased performance to the map. The longer term plan is to continue this optimization path using a GlSurfaceView #5766. Let's continue the conversation there.

Next steps

  • Extract performance measurement methodology into a wiki page @cammace

@cammace
Copy link
Contributor

cammace commented Sep 22, 2016

I've created a new wiki entry on how to test performance. Thanks @justasm.
https://github.com/mapbox/mapbox-gl-native/wiki/Testing-Android-map-performance

@cammace cammace closed this as completed Sep 22, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android performance Speed, stability, CPU usage, memory usage, or power usage
Projects
None yet
Development

No branches or pull requests

4 participants