logo separator

[mkgmap-dev] performance best practice

From Joris Bo jorisbo at hotmail.com on Sat May 30 09:35:41 BST 2020


I have a question about improving performance
(I'm very happy already, I think is absolutely fast enough, its just that I could improve by doing things differently)

I assume the is_in() function requires extra calculations and lookups which may cost time as well calculating unnecessary rules
(That could already be a wrong assumption)

Maybe an expert could just say what would be better in general. No need to prove or test. I tried myself some things which actually did not make a big difference.
For example I moved the rules for buildings to the top of the style and expected serious improvements, because buildings are the majority of polygons in the PBF
But I gained only a little bit (3-5%? max) and even one out of 4 runs it was even a bit slower. So mkgmap must be very optimized already was my conclusion

Question 1)      'unnecessary' processing rules

                        Answer A
Walk through 100 rules about highways when it's a waterway or railway and just wait for rule 101

                        Answer B
                                   Introduce an extra IF, which causes extra calculation itself but skips the 100 rules
IF (highway = *) Then
                                                Highway 1,2,3,4,5,6,7,8-100
                                    Waterway = river [0x18 resolution 22]

Question 2)      Help mkgmap to avoid calculation of possible expensive calculations? Or is it already smart enough to not start the IS_IN() if "name = *" failed already

                        Answer A
                                   waterway = river & name = * & is_in(natural, sea, any) = true    [0x18 resolution 22]

Answer B
                                   If (waterway = river) then
                                               name = * & is_in(natural, sea, any) = true    [0x18 resolution 22]
End if

Joris Bo

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mkgmap.org.uk/pipermail/mkgmap-dev/attachments/20200530/9ec884a2/attachment.html>

More information about the mkgmap-dev mailing list