[mkgmap-dev] [PATCH v1] Add --no-sort-roads option
From Marko Mäkelä marko.makela at iki.fi on Sat Apr 4 20:41:13 BST 2009
Mark, 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.) Marko
- 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