[GraphHopper] With Regards to issue 31

Quinton Anderson quintona at gmail.com
Tue Apr 16 00:56:52 UTC 2013


Hi Peter,

I am not sure what is going on with the mailing list, but I don't receive the mails. I checked the archive in order to see your response. I have checked my spam filter too.

I am not building the graph using run.sh, I am only running this code as a unit test:

public class TestGH {

	@Test
	public void test() {
		GraphHopper gh = new GraphHopper().forServer().contractionHierarchies(true);
		gh.load("./london.osm");
		System.out.println(gh.getGraph().getClass());
		GHRequest request = new GHRequest(51.559997,-0.226593,
				51.448016,0.063171);
		request.algorithm("dijkstrabi");
		StopWatch sw = new StopWatch().start();
		GHResponse response = gh.route(request);
		System.out.println(response.debugInfo());
		System.out.println("Route Time: " + sw.stop().getSeconds());
		System.out.println(response.distance() + " " + response.time());
		PointList points = response.points();
		for (int i = 0; i < points.size(); i++) {
			System.out.println(points.latitude(i) + " : " + points.longitude(i));
		}
	}

}

This will build the graph data in the same way as if I invoked run.sh. forServer gives me what I am guessing are good defaults:
simplify(true);
        preciseIndexResolution(1000);
        return setInMemory(true, true);

Followed by contractionHierarchies():
public GraphHopper contractionHierarchies(boolean fast) {
        chUsage = true;
        chFast = fast;
        return this;
    }

Then when load is called GraphHopper calls the OSMReader in the same way as I would from command line or run.sh.

I have added some more debug output:
class com.graphhopper.storage.LevelGraphStorage
idLookup:0.01s, algoInit:0.0010s, dijkstraCH-routing:0.0060s, extract time:0.0020, simplify (825->401):0.0070s
Route Time: 0.027


It seems that the lookup takes some time. Then, from what I can tell, the actual routing includes the remaining times, being algo init, routing, extraction and simplification. These total 17ms. 

I am also seeing some drastic changes in performance per run. The run above took 27ms, the next run of the same code took 110ms. When I run the same coordinates in the web demo the result is consistently 6 or 7ms.

I guess the next question is: what is included in the timer shown on the webpage? 

Thanks. 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/graphhopper/attachments/20130416/117b9b28/attachment.html>


More information about the GraphHopper mailing list