Performance Issue with getDirectionsMultiDestination Function

Hi,

We’ve noticed that the getDirectionsMultiDestination function is taking longer than expected to execute—around 4 seconds for 3 points and 5-6 seconds for 5 points. This doesn’t seem like the expected behavior. Could you help us identify if there’s anything wrong with the code below or suggest possible causes for the delay?

const firstPoint = currentPosition
  ? mapView.createCoordinate(currentPosition.latitude, currentPosition.longitude)
  : validLocations[0];

const destinations = currentPosition ? validLocations : validLocations.slice(1);

const calculatedRoute = mapSource.getDirectionsMultiDestination(
  firstPoint,
  destinations,
  { smoothing: { enabled: true, radius: 15 } }
);

Thanks in advance for your assistance!

Best regards,

Hi Ali,

I would expect this to be quicker. The processing power of the device will have an impact here. What hardware are you using? Are you able to reproduce these types of times using one of our demo maps? I suggest using the Hospital Demo, which is a more complex map. If so, please post an example with specific spaces.

If not, it’s possible there is an issue with the map you are using and we can investigate in that direction.

1 Like

Thanks for your response! Yes, I have checked the demo app, and the function performs much faster. I will send the map ID (Airport map) via DM, please review it and let us know.

I’ve been able to reproduce this with your map. It appears that the performance hit is caused by path smoothing. As a workaround for now, if you set smoothing to false, the calculation time should drop to less than half a second. In my tests it dropped from 8+ seconds to 0.12 seconds after disabling smoothing (using 4 destinations(.

This will result in a windy looking path. Our SDK team is going to investigate this and improve the performance of smoothing. It shouldn’t have such a large performance hit.

Thank you for looking into this issue on your side. We would like to keep the smoothing for the route on our map. Is there any news about fixing the slow performance of this function?

There is a fix for this being tested internally. It brings the performance of multi-destination directions close to what you’d get with path smoothing enabled.

It should be included in our next release, likely within the next week.

We have just released Mappedin JS & React SDK 6.0.1-beta.30, which resolves the performance issues with path smoothing and getDirectionsMultiDestination.

Please update and let me know if you run into any further issues.

We upgraded the WebApp to the latest SDK version. It is very nice, the route is now drawn instantly and the WebView does not hang anymore. I would say the issue was solved. Thank you very much.

1 Like