Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove duplicate polyline decoding #210

Closed
ericrwolfe opened this issue Sep 7, 2017 · 0 comments
Closed

Remove duplicate polyline decoding #210

ericrwolfe opened this issue Sep 7, 2017 · 0 comments

Comments

@ericrwolfe
Copy link
Contributor

Polylines are decoded 6 times on every new location update (9 times if a new step!) in NavigationEngine.handleRequest:

private void handleRequest(final NewLocationModel newLocationModel) {
final RouteProgress routeProgress = generateNewRouteProgress(
newLocationModel.mapboxNavigation(), newLocationModel.location());
final List<Milestone> milestones = checkMilestones(
previousRouteProgress, routeProgress, newLocationModel.mapboxNavigation());
final boolean userOffRoute = isUserOffRoute(newLocationModel, routeProgress);
final Location location = !userOffRoute && newLocationModel.mapboxNavigation().options().snapToRoute()
? getSnappedLocation(newLocationModel.mapboxNavigation(), newLocationModel.location(), routeProgress)
: newLocationModel.location();

Polyline decoding is expensive especially on long route steps and if GPS updates are frequent, so decoding the polylines a single time when you parse the route json and storing the resulting List<Position> coordinates as part of each LegStep will help significantly with memory usage and general performance.

cc @cammace @danesfeder

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant