logo separator

[mkgmap-dev] [PATCH V3]mkgmap performance

From Steve Ratcliffe steve at parabola.me.uk on Sat Dec 31 00:21:06 GMT 2011


> Maybe it's possible to seperate the id ranges of the FakeIdGenerator?
> Example:
> startId = 1L<<  62 + (tile no - starting with 0) * (1L<<  62 / noOfTiles)
> But that would require that all calls to the FakeIdGenerator are no
> longer static (or they must use the ThreadLocal object?).

That might work, but it's tricky to get the map no to everywhere the 
fake ids are generated.

I have just tested a solution that is probably sufficient for testing 
performance fixes.

There is an option --preserve-element-order which makes the maps used to 
save the ways into LinkedHashMaps which should mean that the iteration 
order is defined by the order they are added to the map and not by the 
hashCode(). I was wondering why this option didn't work to make the maps 

I found the reason: this simple patch in MultiPolygonRelation:

  	private final Map<Long, Way> tileWayMap;
  	private final Map<Long, String> roleMap = new HashMap<Long, String>();
-	private Map<Long, Way> mpPolygons = new HashMap<Long, Way>();
+	private Map<Long, Way> mpPolygons = new LinkedHashMap<Long, Way>();
is all that is needed to make the --preserve-element-order option
work, at least for my test file.


More information about the mkgmap-dev mailing list