[mkgmap-dev] [PATCH v1] Add --no-sort-roads option
From Mark Burton markb at ordern.com on Sat Apr 4 23:32:31 BST 2009
Hi Marko, > On Sat, Apr 04, 2009 at 12:10:54PM +0100, Mark Burton wrote: > > for (RoadDef rd : roads) { > > rd.writeRgnOffsets(rgn); > > - Label[] l = rd.getLabels(); > > - for(int i = 0; i < l.length && l[i] != null; ++i) > > - if(l[i].getLength() != 0) > > - sortedRoads.add(new Sortable<Label, RoadDef>(l[i], rd)); > > + if(sortRoads) { > > + Label[] l = rd.getLabels(); > > + for(int i = 0; i < l.length && l[i] != null; ++i) > > + if(l[i].getLength() != 0) > > + sortedRoads.add(new Sortable<Label, RoadDef>(l[i], rd)); > > + } > > } > > if(sortedRoads.size() > 0) { > > The patch you suggest would do a busy loop of all roads when > sortRoads==false. Can you move the if (sortRoads) before the > for statement? (Also the sortedRoads.size() check could be > skipped if !sortRoads, but that shouldn't cost much CPU, as > it will only be performed once.) Have you seen the rd.writeRgnOffsets(rgn); at the top of the loop? That was the original content of the loop and it needs to stay. Cheers, Mark
- Previous message: [mkgmap-dev] [PATCH v1] Add --no-sort-roads option
- Next message: [mkgmap-dev] [PATCH v1] Add --no-sort-roads option
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the mkgmap-dev mailing list