mapbox-navigation-android icon indicating copy to clipboard operation
mapbox-navigation-android copied to clipboard

optimize vanishing line updates when going through restrictions and legs aren't styled independently

Open LukasPaczos opened this issue 3 years ago • 1 comments

Description

https://github.com/mapbox/mapbox-navigation-android/issues/6167 describes an issue of using the full extracted route data LRU cache, which key is based on the full hash of the DirectionsRoute. The cache lookup is actually only needed when the legs are styled independently, since we can't use the trim-offset expression for that scenario. This PR addresses the issue for a scenario where independently styled route legs are not used.

There's a huge performance improvement for a route from Munich to Madrid going through restrictions: before

Screenshot from 2022-08-15 12-47-47

after Screenshot from 2022-08-15 12-50-34

We can see a main thread usage by the MapboxRouteLineApi#updateTraveledRouteLine dropping from over 20% to less than 1% on a Samsung S22+.

LukasPaczos avatar Aug 15 '22 11:08 LukasPaczos

Codecov Report

Merging #6169 (cbdadf5) into main (9e06a81) will decrease coverage by 0.03%. The diff coverage is 0.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##               main    #6169      +/-   ##
============================================
- Coverage     68.91%   68.88%   -0.04%     
+ Complexity     4258     4256       -2     
============================================
  Files           639      639              
  Lines         25663    25662       -1     
  Branches       3004     3004              
============================================
- Hits          17686    17676      -10     
- Misses         6830     6841      +11     
+ Partials       1147     1145       -2     
Impacted Files Coverage Δ
...ation/ui/maps/route/line/api/MapboxRouteLineApi.kt 82.75% <0.00%> (-1.18%) :arrow_down:
...ui/maps/route/line/model/MapboxRouteLineOptions.kt 82.71% <ø> (ø)

codecov[bot] avatar Aug 15 '22 12:08 codecov[bot]