[OSM-dev] Performance

SteveC steve at asklater.com
Wed Jul 12 12:48:46 BST 2006


heres a patch to make the dialog speed up, and a ant file so you can
build the source easily... I think imi will add them when he gets round
to it?

* @ 12/07/06 11:45:36 AM nigel.magnay at gmail.com wrote:
> I've been idly playing around with some datasets from the april
> planet.osm, and I'm wondering as to where (and if) there's performance
> bottlenecks.
> 
> I first stumbled across OSM last week and thought "this is *way*
> cool". So I downloaded JOSM, and plugged some coordinates in
> (bbox=-1.40625,51.630859375,-1.0546875,51.796875 for these examples)
> 
> Given that area, it seems to take JOSM about 45-odd seconds on my
> machine to display, of which 25 seconds seems to be waiting for a
> response.
> 
> However, a straight api call of
> /map?bbox=-1.40625,51.630859375,-1.0546875,51.796875 seems to take
> about 12 seconds. It's got a fair amount of work to do and I do note
> the status page mentions database performance issues.
> 
> Thinking that it was query-bound, I hacked a quick java equivalent of
> the API, ran the same queries (though I had to substitute
> current_nodes for nodes, etc), and found I could return equivalent xml
> from my creaky old local machine as XML in about 5-6 seconds (5558
> nodes, 6154 segments, 238 Ways)
> 
> Is ruby particularly slow at the rowset->xml generation phase? Is JOSM
> doing more work than a simple map call ?
> 
> _______________________________________________
> dev mailing list
> dev at openstreetmap.org
> http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/dev

have fun,

SteveC steve at asklater.com http://www.asklater.com/steve/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: build.xml
Type: application/xml
Size: 1254 bytes
Desc: not available
URL: <http://lists.openstreetmap.org/pipermail/dev/attachments/20060712/9c5cfac6/attachment.xml>
-------------- next part --------------
Index: src/org/openstreetmap/josm/io/ProgressReader.java
===================================================================
--- src/org/openstreetmap/josm/io/ProgressReader.java   (revision 107)
+++ src/org/openstreetmap/josm/io/ProgressReader.java   (working copy)
@@ -19,6 +19,7 @@
        private final BoundedRangeModel progress;
        private final JLabel currentAction;
        private int readSoFar = 0;
+       private int lastDialogUpdate = 0;
 
        public ProgressReader(URLConnection con, BoundedRangeModel progress, JLabel currentAction) throws IOException {
                this.in = new InputStreamReader(con.getInputStream());
@@ -39,21 +40,25 @@
        @Override public int read() throws IOException {
                int read = in.read();
                readSoFar++;
-
-               String progStr = " ("+readSoFar+"/";
-               if (progress.getMaximum() == 0)
-                       progStr += "???)";
-               else
-                       progStr += progress.getMaximum()+")";
-
-               String cur = currentAction.getText();
-               int i = cur.indexOf(' ');
-               if (i != -1)
-                       cur = cur.substring(0, i) + progStr;
-               else
-                       cur += progStr;
-               currentAction.setText(cur);
-               progress.setValue(readSoFar);
+    
+    if(readSoFar / 1024 > lastDialogUpdate)
+    {
+      lastDialogUpdate++;
+               String progStr = " ("+readSoFar/1024+"/";
+               if (progress.getMaximum() == 0)
+                       progStr += "???) Kb";
+               else
+                       progStr += progress.getMaximum()+")";
+  
+               String cur = currentAction.getText();
+               int i = cur.indexOf(' ');
+               if (i != -1)
+                       cur = cur.substring(0, i) + progStr;
+               else
+                       cur += progStr;
+               currentAction.setText(cur);
+               progress.setValue(readSoFar);
+    }
                return read;
     }
 }


More information about the dev mailing list