Skip to content

Commit

Permalink
Speed up by paralell search of nearestEdge
Browse files Browse the repository at this point in the history
  • Loading branch information
tcoupin committed Dec 4, 2017
1 parent 3692740 commit f56a6fb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,9 @@ class RouteEngine {
response.cost[v]=0;
})

let startPoints=await this._findNearestEdge(params.from, params.avoid);
let endPoints=await this._findNearestEdge(params.to, params.avoid);
let StartEndPoints = await Promise.all([this._findNearestEdge(params.from, params.avoid),this._findNearestEdge(params.to, params.avoid)])
let startPoints=StartEndPoints[0];
let endPoints=StartEndPoints[1];

let path = await this._searchPath(params.type, startPoints, endPoints, params.avoid)
if (path.length == 0){
Expand Down

0 comments on commit f56a6fb

Please sign in to comment.