logo separator

[mkgmap-dev] [PATCH v4] LocationHook speedup

From WanMil wmgcnfg at web.de on Sat Dec 31 14:15:00 GMT 2011

Great!
(Although for a nitpicker your patch is wrong. One could create a 
directory containing one subdir named "123.bnd". This directory would be 
detected as sufficient bounds dir by your patch. But I think we can 
ignore this :-)

WanMil

> I used another way to optimize that part. On my machine, the list()
> method is much faster than listFiles():
>
> String [] boundaryFileNames = boundaryDir.list();
> boolean foundBndFile = false;
> for (String s: boundaryFileNames){
> if (s.endsWith(".bnd")) {
> foundBndFile = true;
> break;
> }
> }
> if (!foundBndFile) {
> log.error("Disable LocationHook because boundary directory contains
> files. Dir: "
> + boundaryDir);
> return false;
> }
>
>
> Gerd
>
> I've found and fixed another performance bottleneck:
> The init method of the LocationHook contained a check if there is any
> bounds file in the boundary directory. On my computer this check
> requires ~1200ms. This is done for each tile and must be perfomed once
> only.
> So attached patch saves additionally 1200ms for each tile :-)
>
> WanMil
>
>>  I tried to improve the first patch by removing anything not required in
>>  the Quadtree and by using a different internal data structure.
>>
>>  I've seen performance improvements but please try and test yourself :-)
>>
>>  The most time is now spend in the creation of the Quadtree. So if you
>>  want to search for more performance just start there.
>>
>>  WanMil
>>
>>
>>>  Gerds patches inspired me to look for more things that could be improved.
>>>
>>>  I found that the Quadtree used in the LocationHook is not very optimal.
>>>  The patch is a first try to increase the performance. The time required
>>>  for the LocationHook is reduced by 10-50% which is great.
>>>
>>>  Warning: I haven't checked so far if the results are equal. So maybe
>>>  there are big bugs in the patch... (and the speedup comes from the poor
>>>  implementation)
>>>
>>>  I will do some more tests and optimizations but maybe some of you can
>>>  have a look on it, test it and comment it.
>>>
>>>  Have fun!
>>>  WanMil
>
>
>
> _______________________________________________
> mkgmap-dev mailing list
> mkgmap-dev at lists.mkgmap.org.uk
> http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

-------------- next part --------------
A non-text attachment was scrubbed...
Name: quadtree_speedup_v4.patch
Type: text/x-patch
Size: 28401 bytes
Desc: not available
Url : http://lists.mkgmap.org.uk/pipermail/mkgmap-dev/attachments/20111231/c697d1ce/attachment.bin 


More information about the mkgmap-dev mailing list