[GraphHopper] With Regards to issue 31

Peter K peathal at yahoo.de
Tue Apr 16 06:59:30 UTC 2013


Hi Quinton,

yes, I also had some strange problems with the mailing list :( I've
tuned the digest setting a bit (hopefully this helps) the defaults of
mailman are really bad sometimes. Sorry for this!

Now regarding your problem: it could be that you've trapped in the micro
benchmark problems with Java that every one (including me*) is trapped
at some stage :)
You are loading the graph correctly but you execute the request only
once. Try running it several times so that the JVM can optimize your
code / 'hotspot'!

See OSMReader where I do:
//first call is the warmup !
tests.runShortestPathPerf(...)
tests.runShortestPathPerf(...)


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

The demo is identical to the graphhopper-web project. See
GraphHopperServlet:
sw = new StopWatch().start();
GHResponse rsp = hopper.route(new GHRequest(start, end)....
float took = sw.stop().getSeconds();

Ie. the complete graphhopper.route call is included (BTW: not the
network latency).
The web demo stays online all the time and so the code stays optimized
and you see those low values.

Still curious if that was your problem and if you've now recieved
mailman mails :) ! To be sure I've added your mail as BCC ...

Regards,
Peter.

*
see comments from Aleksej!
http://karussell.wordpress.com/2009/05/21/microbenchmarking-java-compare-algorithms/


> 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:
>
> publicclassTestGH {
>
> @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. 
>
>
> _______________________________________________
> GraphHopper mailing list
> GraphHopper at openstreetmap.org
> http://lists.openstreetmap.org/listinfo/graphhopper


-- 
GraphHopper.com Your way is our destination!

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


More information about the GraphHopper mailing list