Monday, April 15, 2013

Faster Calculation in RouteFinder

Yesterday I made a change to how the RouteFinder works. Previously, every time a route was calculated, it was calculated from scratch. If it took 90 seconds to complete, it would take that long every time it was calculated. Now, the first time it is calculated, the results are saved. Every time after that, the results from the previous calculation are used. It just takes a second to access the results and send them back to your browser.

The advantages to this method is that it becomes much easier to share a route with others. While it may take a bit longer (not much, but a bit) to calculate the first time, it should be much faster every time after that. Everyone accessing the route will not have to wait for the website to calculate it.

This update also somewhat changes the strategy in calculating long routes. I usually suggested adding destinations along long routes, at least at every spot where the route changed direction. Now the decision of how many "intermediate destinations" to use becomes more of a balancing act. The more destinations that are specified, the more files that need to be accessed. The calculation will be fast, but accessing the files will take time. Long routes take a long time to calculate (with a 2 minute limit), but after it has been successfully calculated, thereafter it will be very fast.

While I believe the changes work, I will still be ironing out some wrinkles in the programming over the next few weeks, so please be patient if the RouteFinder has some errors.

No comments:

Post a Comment