-
Notifications
You must be signed in to change notification settings - Fork 130
Nested regex can cause extremely slow generation times and longer xml #213
Comments
This is probably unavoidable. We can make judgments about zoom level filters and other relative filters, like We can't do that with regex filters unless we have some kind of zany meta-regex-evaluator which compares their DFAs and derives new ones that are combinations and exclusions of each other. |
@smsm1 - would you mind pasting a few before/after of the Mapnik XML based on a given change? |
Before: http://shaunmcdonald.me.uk/tmp/carto/open-streets-dc-orginal.xml Changed about line 119 from: To: |
thank you @smsm1 |
ugh, the diff is larger than either xml. And many of the differences seem not directly related to the change: http://cl.ly/code/0l1V2S0O0W2n. @tmcw - are you positive this bug is "unavoidable" ? |
I'm positive that the regex-makes-more-rules bug is unavoidable unless carto or mapnik changes its approach, but it sounds like you're seeing a different bug than that. |
http://shaunmcdonald.me.uk/tmp/carto/open-streets-dc-orginal-2.xml is an even simpler change to (note the extra tilde) [type=~'motorway'], |
It seems like the next step is to try to create a very small testcase (small stylesheet, only one layer...) and to use it to try to tease out if there are multiple bugs. |
I've got a case where 4 levels of indentation (levels of filters) with no regex can cause generation of the mapnik xml to jump, even so it makes the document simpler to read with less duplication. |
@smsm1 can you create & post a testcase for this? the effect of the filter nesting is entirely dependent on the filters themselves. |
Hmm, I've just started using regexes because they're so much more concise:
This bug is a bit alarming. I'd agree with @smsm1's comment that maybe just syntax for the most important use case would be enough? For me, it would definitely be this one - I could very easily live without even wildcard matches, but the ability to concisely express a set of possible things to match against is very valuable. Maybe even: |
So far I'm not seeing problems with a minimal example like
Also
is ok. But with the open-streets-dc style I see an increase in 3200 lines. Challenge seems to be to find a "minimal" example that is not too minimal. |
Right now I could not confirm that there is an interaction of bugs. Starting with https://github.com/tilemill-project/tilemill/blob/master/examples/open-streets-dc/highway.mss#L82-L160 and condensing it further seems to bring the number of lines closer together for the regex and non-regex case. Until it reaches an equal number of lines when there is only one sub selector. Writing @tmcw is probably right with what he wrote in #213 (comment). |
As a particularly noticeable example is the TileMill example open-streets-dc where converting two sections with the widths to regex, or even just changing a few lines from = to =~ gives significantly different results.
https://github.com/tilemill-project/tilemill/blob/master/examples/open-streets-dc/highway.mss#L119 is an example line to change to get the difference.
I'm using Carto 0.9.4.
The text was updated successfully, but these errors were encountered: