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

Profile gestures #9476

Closed
tobrun opened this issue Jul 11, 2017 · 0 comments
Closed

Profile gestures #9476

tobrun opened this issue Jul 11, 2017 · 0 comments
Assignees
Labels
Android Mapbox Maps SDK for Android

Comments

@tobrun
Copy link
Member

tobrun commented Jul 11, 2017

tldr We are doing too much work as part of our gesture interaction. This ticket scopes responsibilities, profiles gestures and proposes optimizations or link related tickets.

Responsibilities of gesture detectors

  • transforming the map
  • setup camera invalidation (notifying user about transformations)
  • validate and reset tracking modes if required
  • push gesture related telemetry events
  • validate using a focal point vs centre of gesture.

Scroll gesture trace

In below traces we have disabled Telemetry for ease of profiling.

Memory trace

Below a memory trace captured from a scroll gesture:

image

Most notable are the 42 allocation for CowIterator (used to iterate on MapChangeListeners to deliver map change events). Though also interested in CameraPosition as ArrayList iterators allocations.

CowIterator allocations

The way forward removing these allocations is with #8389.

ArrayList Iterator allocations

The source of this is updating InfoWindows. Every time the map transforms we need to update the infoWindow. InfoWindows are collected in a List and for this we need to create an iterator. Currently we create an iterator even if there aren't any InfoWindows on screen. Checking for !infoWindows.isEmpty removes iterator allocations from default behaviour.

CameraPosition allocations

Camera position allocations occur when we need to update components on top of the map + need to notify end users about transformation changes. The latter has become obsolete with the new camera change api in #8644. Need to investigate rewriting the invalidation part for it.

CPU Trace

image

In the trace above you can see 31.84% of the trace was spend on NativeMapView#render:

  • 31.56 % was spend in c++ for rendering
  • 0.29 % was spend on dispatching map change events and updating UI afterwards

Other gesture traces

TBA

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android
Projects
None yet
Development

No branches or pull requests

1 participant