[mkgmap-dev] natural=wetland; why is ~ disallowed at top level?
From Steve Ratcliffe steve at parabola.me.uk on Sun Jan 17 18:48:20 GMT 2010
On 16/01/10 11:48, Marko Mäkelä wrote: > For what it is worth, I was wondering if it would be faster to execute > the style as > > natural ~ 'marsh\|mud\|wetland' [0x51 resolution 20] > Why not? A regexp match with one hash lookup ought to be faster than > three hash lookups and string equality comparisons. It doesn't work like that, so we don't do multiple hash lookups and equality comparisons for each rule. We go through the tags and look each one up, based on an index consisting of the tag and value. So all rules that could be matched by say natural=mud are indexed by the string 'natural=mud' So if an element has the tag natural=mud then we find the [0x51 ...] directly without looking at natural=marsh or natural=wetland or doing any other comparison. If you have a regexp then you have to run it for every natural=* tag so it becomes natural=* & natural ~ 'marsh\|mud\|wetland' [0x51 resolution 20] So this involves a hash table lookup and a regexp comparison instead of just a hash table lookup and so it will be slower. ..Steve
- Previous message: [mkgmap-dev] natural=wetland; why is ~ disallowed at top level?
- Next message: [mkgmap-dev] natural=wetland; why is ~ disallowed at top level?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the mkgmap-dev mailing list