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

Jank during scroll #4488

Closed
Closed

Description

@justasm

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

Activity

  1. added
    Android
    on Mar 28, 2016
  2. bleege commented on Mar 31, 2016

    @bleege
    Contributor

    @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

  3. added
    performance
    on Mar 31, 2016
  4. bleege commented on Mar 31, 2016

    @bleege
    Contributor
  5. zugaldia commented on Sep 22, 2016

    @zugaldia
    Member

    @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
  6. cammace commented on Sep 22, 2016

    @cammace
    Contributor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Androidperformance

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions