Try to speedup pt calculation

This commit is contained in:
Victor Shcherb 2019-03-15 14:41:05 +01:00
parent 50bdc0083d
commit bb509f9ab6
3 changed files with 9 additions and 4 deletions

View file

@ -103,6 +103,7 @@ public class TransportRoutePlanner {
}
sgms.clear();
sgms = ctx.getTransportStops(stop.x31, stop.y31, true, sgms);
ctx.visitedStops++;
for (TransportRouteSegment sgm : sgms) {
if (ctx.calculationProgress != null && ctx.calculationProgress.isCancelled) {
return null;
@ -200,9 +201,11 @@ public class TransportRoutePlanner {
private List<TransportRouteResult> prepareResults(TransportRoutingContext ctx, List<TransportRouteSegment> results) {
Collections.sort(results, new SegmentsComparator(ctx));
List<TransportRouteResult> lst = new ArrayList<TransportRouteResult>();
System.out.println(String.format("Calculated %.1f seconds, found %d results, visited %d routes, loaded %d tiles (%d ms read, %d ms total),",
(System.currentTimeMillis() - ctx.startCalcTime) / 1000.0, results.size(), ctx.visitedRoutesCount,
ctx.quadTree.size(), ctx.readTime / (1000 * 1000), ctx.loadTime / (1000 * 1000)));
System.out.println(String.format("Calculated %.1f seconds, found %d results, visited %d routes / %d stops, loaded %d tiles (%d ms read, %d ms total), loaded ways %d (%d wrong)",
(System.currentTimeMillis() - ctx.startCalcTime) / 1000.0, results.size(),
ctx.visitedRoutesCount, ctx.visitedStops,
ctx.quadTree.size(), ctx.readTime / (1000 * 1000), ctx.loadTime / (1000 * 1000),
ctx.loadedWays, ctx.wrongLoadedWays));
for(TransportRouteSegment res : results) {
if (ctx.calculationProgress != null && ctx.calculationProgress.isCancelled) {
return null;
@ -650,6 +653,7 @@ public class TransportRoutePlanner {
// stats
public long startCalcTime;
public int visitedRoutesCount;
public int visitedStops;
public int wrongLoadedWays;
public int loadedWays;
public long loadTime;

View file

@ -4,7 +4,7 @@ public class TransportRoutingConfiguration {
public static final String KEY = "public_transport";
public int ZOOM_TO_LOAD_TILES = 14;
public int ZOOM_TO_LOAD_TILES = 15;
public int walkRadius = 1500; // ? 3000

View file

@ -112,6 +112,7 @@ public class MapUtils {
}
/**
* Gets distance in meters
*/