<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi Peter,<div><br></div><div>I received the mail from you, not from the mailing list. </div><div><br></div><div>My first round of evaluation is complete and graphhopper is looking good. So I will start to spend some time of this now. Look forward to some more discussions.</div><div><br></div><div>Regards,</div><div>Quinton Anderson</div><div><br><div><div>On 16 Apr 2013, at 4:59 PM, Peter K wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">
  
    <meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type">
  
  <div bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Hi Quinton,<br>
      <br>
      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!<br>
      <br>
      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 :)<br>
      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'!<br>
      <br>
      See OSMReader where I do:<br>
      //first call is the warmup !<br>
      tests.runShortestPathPerf(...)<br>
      tests.runShortestPathPerf(...)<br>
      <br>
      <br>
      <div>> I guess the next question is: what is included in the
        timer shown on the webpage? </div>
      <br>
      The demo is identical to the graphhopper-web project. See
      GraphHopperServlet:<br>
      sw = new StopWatch().start();<br>
      GHResponse rsp = hopper.route(new GHRequest(start, end)....<br>
      float took = sw.stop().getSeconds();<br>
      <br>
      Ie. the complete graphhopper.route call is included (BTW: not the
      network latency).<br>
      The web demo stays online all the time and so the code stays
      optimized and you see those low values.<br>
      <br>
      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 ...<br>
      <br>
      Regards,<br>
      Peter.<br>
      <br>
      *<br>
      see comments from Aleksej!<br>
<a class="moz-txt-link-freetext" href="http://karussell.wordpress.com/2009/05/21/microbenchmarking-java-compare-algorithms/">http://karussell.wordpress.com/2009/05/21/microbenchmarking-java-compare-algorithms/</a><br>
      <br>
      <br>
    </div>
    <blockquote cite="mid:28AE6F6F-FA78-4884-B6A0-989173AAF25E@gmail.com" type="cite">Hi Peter,
      <div><br>
      </div>
      <div>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.</div>
      <div><br>
      </div>
      <div>I am not building the graph using run.sh, I am only running
        this code as a unit test:</div>
      <div><br>
      </div>
      <div>
        <div style="margin-top: 0px; margin-right: 0px; margin-bottom:
          0px; margin-left: 0px; font: normal normal normal 11px/normal
          Monaco; color: rgb(148, 25, 101); ">public<span style="color:
            #000000"> </span>class<span style="color: #000000"> TestGH
            {</span></div>
        <div style="margin-top: 0px; margin-right: 0px; margin-bottom:
          0px; margin-left: 0px; font: normal normal normal 11px/normal
          Monaco; min-height: 15px; "><br>
        </div>
        <div style="margin-top: 0px; margin-right: 0px; margin-bottom:
          0px; margin-left: 0px; font: normal normal normal 11px/normal
          Monaco; color: rgb(119, 119, 119); "><span style="color:
            #000000"><span class="Apple-tab-span" style="white-space:pre"> </span></span>@Test</div>
        <div style="margin-top: 0px; margin-right: 0px; margin-bottom:
          0px; margin-left: 0px; font: normal normal normal 11px/normal
          Monaco; "><span class="Apple-tab-span" style="white-space:pre">
          </span><span style="color: #941965">public</span> <span style="color: #941965">void</span> test() {</div>
        <div style="margin-top: 0px; margin-right: 0px; margin-bottom:
          0px; margin-left: 0px; font: normal normal normal 11px/normal
          Monaco; "><span class="Apple-tab-span" style="white-space:pre">
          </span>GraphHopper gh = <span style="color: #941965">new</span>
          GraphHopper().forServer().contractionHierarchies(<span style="color: #941965">true</span>);</div>
        <div style="margin-top: 0px; margin-right: 0px; margin-bottom:
          0px; margin-left: 0px; font: normal normal normal 11px/normal
          Monaco; color: rgb(62, 56, 245); "><span style="color:
            #000000"><span class="Apple-tab-span" style="white-space:pre"> </span>gh.load(</span>"./london.osm"<span style="color: #000000">);</span></div>
        <div style="margin-top: 0px; margin-right: 0px; margin-bottom:
          0px; margin-left: 0px; font: normal normal normal 11px/normal
          Monaco; "><span class="Apple-tab-span" style="white-space:pre">
          </span>System.<span style="color: #102bc3">out</span>.println(gh.getGraph().getClass());</div>
        <div style="margin-top: 0px; margin-right: 0px; margin-bottom:
          0px; margin-left: 0px; font: normal normal normal 11px/normal
          Monaco; "><span class="Apple-tab-span" style="white-space:pre">
          </span>GHRequest request = <span style="color: #941965">new</span>
          GHRequest(51.559997,-0.226593,</div>
        <div style="margin-top: 0px; margin-right: 0px; margin-bottom:
          0px; margin-left: 0px; font: normal normal normal 11px/normal
          Monaco; "><span class="Apple-tab-span" style="white-space:pre">
          </span>51.448016,0.063171);</div>
        <div style="margin-top: 0px; margin-right: 0px; margin-bottom:
          0px; margin-left: 0px; font: normal normal normal 11px/normal
          Monaco; "><span class="Apple-tab-span" style="white-space:pre">
          </span>request.algorithm(<span style="color: #3e38f5">"dijkstrabi"</span>);</div>
        <div style="margin-top: 0px; margin-right: 0px; margin-bottom:
          0px; margin-left: 0px; font: normal normal normal 11px/normal
          Monaco; "><span class="Apple-tab-span" style="white-space:pre">
          </span>StopWatch sw = <span style="color: #941965">new</span>
          StopWatch().start();</div>
        <div style="margin-top: 0px; margin-right: 0px; margin-bottom:
          0px; margin-left: 0px; font: normal normal normal 11px/normal
          Monaco; "><span class="Apple-tab-span" style="white-space:pre">
          </span>GHResponse response = gh.route(request);</div>
        <div style="margin-top: 0px; margin-right: 0px; margin-bottom:
          0px; margin-left: 0px; font: normal normal normal 11px/normal
          Monaco; "><span class="Apple-tab-span" style="white-space:pre">
          </span>System.<span style="color: #102bc3">out</span>.println(response.debugInfo());</div>
        <div style="margin-top: 0px; margin-right: 0px; margin-bottom:
          0px; margin-left: 0px; font: normal normal normal 11px/normal
          Monaco; "><span class="Apple-tab-span" style="white-space:pre">
          </span>System.<span style="color: #102bc3">out</span>.println(<span style="color: #3e38f5">"Route Time: "</span> +
          sw.stop().getSeconds());</div>
        <div style="margin-top: 0px; margin-right: 0px; margin-bottom:
          0px; margin-left: 0px; font: normal normal normal 11px/normal
          Monaco; "><span class="Apple-tab-span" style="white-space:pre">
          </span>System.<span style="color: #102bc3">out</span>.println(response.distance()
          + <span style="color: #3e38f5">" "</span> + response.time());</div>
        <div style="margin-top: 0px; margin-right: 0px; margin-bottom:
          0px; margin-left: 0px; font: normal normal normal 11px/normal
          Monaco; "><span class="Apple-tab-span" style="white-space:pre">
          </span>PointList points = response.points();</div>
        <div style="margin-top: 0px; margin-right: 0px; margin-bottom:
          0px; margin-left: 0px; font: normal normal normal 11px/normal
          Monaco; "><span class="Apple-tab-span" style="white-space:pre">
          </span><span style="color: #941965">for</span> (<span style="color: #941965">int</span> i = 0; i <
          points.size(); i++) {</div>
        <div style="margin-top: 0px; margin-right: 0px; margin-bottom:
          0px; margin-left: 0px; font: normal normal normal 11px/normal
          Monaco; "><span class="Apple-tab-span" style="white-space:pre">
          </span>System.<span style="color: #102bc3">out</span>.println(points.latitude(i)
          + <span style="color: #3e38f5">" : "</span> +
          points.longitude(i));</div>
        <div style="margin-top: 0px; margin-right: 0px; margin-bottom:
          0px; margin-left: 0px; font: normal normal normal 11px/normal
          Monaco; "><span class="Apple-tab-span" style="white-space:pre">
          </span>}</div>
        <div style="margin-top: 0px; margin-right: 0px; margin-bottom:
          0px; margin-left: 0px; font: normal normal normal 11px/normal
          Monaco; "><span class="Apple-tab-span" style="white-space:pre">
          </span>}</div>
        <div style="margin-top: 0px; margin-right: 0px; margin-bottom:
          0px; margin-left: 0px; font: normal normal normal 11px/normal
          Monaco; min-height: 15px; "><br>
        </div>
        <div style="margin-top: 0px; margin-right: 0px; margin-bottom:
          0px; margin-left: 0px; font: normal normal normal 11px/normal
          Monaco; ">}</div>
      </div>
      <div><br>
      </div>
      <div>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:</div>
      <div>
        <div style="margin-top: 0px; margin-right: 0px; margin-bottom:
          0px; margin-left: 0px; font: normal normal normal 11px/normal
          Monaco; ">simplify(<span style="color: #941965">true</span>);</div>
        <div style="margin-top: 0px; margin-right: 0px; margin-bottom:
          0px; margin-left: 0px; font: normal normal normal 11px/normal
          Monaco; ">        preciseIndexResolution(1000);</div>
        <div style="margin-top: 0px; margin-right: 0px; margin-bottom:
          0px; margin-left: 0px; font: normal normal normal 11px/normal
          Monaco; ">        <span style="color: #941965">return</span>
          setInMemory(<span style="color: #941965">true</span>, <span style="color: #941965">true</span>);</div>
      </div>
      <div><br>
      </div>
      <div>Followed by contractionHierarchies():</div>
      <div>
        <div style="margin-top: 0px; margin-right: 0px; margin-bottom:
          0px; margin-left: 0px; font: normal normal normal 11px/normal
          Monaco; "><span style="color: #941965">public</span>
          GraphHopper contractionHierarchies(<span style="color:
            #941965">boolean</span> fast) {</div>
        <div style="margin-top: 0px; margin-right: 0px; margin-bottom:
          0px; margin-left: 0px; font: normal normal normal 11px/normal
          Monaco; ">        <span style="color: #102bc3">chUsage</span>
          = <span style="color: #941965">true</span>;</div>
        <div style="margin-top: 0px; margin-right: 0px; margin-bottom:
          0px; margin-left: 0px; font: normal normal normal 11px/normal
          Monaco; ">        <span style="color: #102bc3">chFast</span>
          = fast;</div>
        <div style="margin-top: 0px; margin-right: 0px; margin-bottom:
          0px; margin-left: 0px; font: normal normal normal 11px/normal
          Monaco; ">        <span style="color: #941965">return</span>
          <span style="color: #941965">this</span>;</div>
        <div style="margin-top: 0px; margin-right: 0px; margin-bottom:
          0px; margin-left: 0px; font: normal normal normal 11px/normal
          Monaco; ">    }</div>
      </div>
      <div><br>
      </div>
      <div>Then when load is called GraphHopper calls the OSMReader in
        the same way as I would from command line or run.sh.</div>
      <div><br>
      </div>
      <div>I have added some more debug output:</div>
      <div>
        <div style="margin-top: 0px; margin-right: 0px; margin-bottom:
          0px; margin-left: 0px; font: normal normal normal 11px/normal
          Monaco; ">class com.graphhopper.storage.LevelGraphStorage</div>
        <div style="margin-top: 0px; margin-right: 0px; margin-bottom:
          0px; margin-left: 0px; font: normal normal normal 11px/normal
          Monaco; ">idLookup:0.01s, algoInit:0.0010s,
          dijkstraCH-routing:0.0060s, extract time:0.0020, simplify
          (825->401):0.0070s</div>
        <div style="margin-top: 0px; margin-right: 0px; margin-bottom:
          0px; margin-left: 0px; font: normal normal normal 11px/normal
          Monaco; ">Route Time: 0.027</div>
      </div>
      <div><br>
      </div>
      <div><br>
      </div>
      <div>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. </div>
      <div><br>
      </div>
      <div>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.</div>
      <div><br>
      </div>
      <div>I guess the next question is: what is included in the timer
        shown on the webpage? </div>
      <div><br>
      </div>
      <div>Thanks. </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
GraphHopper mailing list
<a class="moz-txt-link-abbreviated" href="mailto:GraphHopper@openstreetmap.org">GraphHopper@openstreetmap.org</a>
<a class="moz-txt-link-freetext" href="http://lists.openstreetmap.org/listinfo/graphhopper">http://lists.openstreetmap.org/listinfo/graphhopper</a>
</pre>
    </blockquote>
    <br>
    <br>
    <pre class="moz-signature" cols="72">-- 
<a href="http://GraphHopper.com">GraphHopper.com</a> Your way is our destination!</pre>
  </div>

</blockquote></div><br></div></body></html>