-
Notifications
You must be signed in to change notification settings - Fork 129
Certain selector combinations negatively affect compile time #470
Comments
I'm undecided if this is a bug or not, but this would need improvement. Thanks for the investigation so far. openstreetmap-carto has slow layers also in the Mapnik XML case but not that slow. I know not enough about the vector workflow to say what could be different there. Needs more investigation. |
Some more "print statement debugging" tells me that for the upstream project, the layers have much less items in the I know openstreetmap-carto is complicated and slow, but it's the difference which is the bug for me. If it took about the same time, that would be one thing. To me, this is a bug, since it negatively affects what should be a valid work flow. |
Ok, let's call it a bug then. |
Doesn't run for me.
Have you seen that before? |
I've seen that. You can work around it by running the tmsource on port 8081 in one tessera process/terminatl window, and the tmstyle in another window. I'll post full details on Monday |
I have fixed the my vector tiles project, so |
Some random notes not necessarily related to the behaviour, primarily for myself:
|
I have turned on benchmarking mode for carto, which you can achieve if you call processing layer: text-poly-low-zoom These three layers alone take nearly 3 minutes on my machine. For comparison compiling osm-carto with the benchmark option on the command line gives: processing layer: text-poly-low-zoom |
The downstream version of osm-carto does not use classes, so this statement was invalid. EDIT: changed project.yml e.g. |
If you change the
Yes. I have changed tilelive-tmsource & -tmstyle to use |
Further investigation implies that this isn't a bug in carto, per se, but that some of the changes to support vector tiles made the CartoCSS much more complicated, with more permutations, and hence it takes carto much longer to process and parse the file. You can see this if you open up the style files for upstream osm-carto and the vector tiles in a diff viewer (e.g. meld), and copy some of the changes to the original osm-carto style. You'll see the carto command takes much longer, and see that there are more Specifically look at the commits/patches to support Which implies there's almost no way to fix this problem, short of making carto much faster.... ¹ I have put this line in after L43 of
|
Ah, you removed the classes. I have not seen that. That means that I was on the wrong track. Until now I thought there have not been a lot of changes in the style. But now that means I cannot compare the two variants of the style anymore. |
I think geofabrik/openstreetmap-carto-vector-tiles@fb863ad might be (one of) the reason/s for the rule explosion in the text layers. |
The following simple patch on the current HEAD of osm-carto (
|
Yes, I have also tried reverting geofabrik/openstreetmap-carto-vector-tiles@fb863ad and the performance is back to "normal" for the text layers. Of course reverting is no option, but until #206, #20 or other problems are fixed, there have to be measures taken in the style to keep the performance in reasonable bounds. Help with improvements is always welcome. I myself am also quite late to the carto party and do not have insight into everything. |
@rory Side note: You could also try magnacarto a Go implementation of CartoCSS, which I have made available to Node.js. It works with Kosmtik by installing the kosmtik-magnacarto plugin and specifiying While it works well with the raster approach I just tried the vector approach but could not get it to work because the parser is called twice, once with Stylesheet property and once without. While carto works fine without this property magnacarto does not like that. You could also try plugging it into tessera if you like that better. magnacarto parses generally faster and I have not seen any longer parsing times with your modifications to osm-carto. |
That's an interesting suggestion. However my nodejs knowledge is current not good enough for that. :) |
I can probably improve my CartoCSS selectors. In this example I have one nested |
…sible Previously, this style had attempted to replicate the upstream osm-carto exactly. This meant the using the `way_pixels` and zoom trick to get the same results. But that results in a combinatorial explosion for amenity-points, which means carto can go from 30 seconds to parse the file, to 3½minutes. By removing this inner selectors, the carto performance will be back to about 30 seconds. This affects the start up time of tessera/tilelive. cf.: * mapbox/carto#470 * mapbox/carto#20
I have ported the openstreetmap-carto style to vector tiles, and am using tessera, which is based on tilelive, to serve the raster tiles (which are created from vectortiles). However it takes a very long time to start up (~4 minutes) and that's from carto's processing of the cartocss files. I initially reported this on the tessera issue tracker, see more background there
Using simple print statement debugging, I can see that some of the longest parts are inside the
rules = inheritDefinitions(matching, env);
call. For some osm-carto layers, there are thousands of items in thematching
variable. (e.g.test-polyg-low-zoom
has 6,005.bridges
has 1,099,test-poly
as 6,064 etc). It takes about 1 second (on my machine) for every 1,000 items. so some of these layers take about 5sec to process. There are lots of layers, so it's about 3½ minutes to parse the whole file.A weird thing is that I can use the same node_modules to parse the upstream project.mml into mapnik XML in 24sec. This is only a problem when parsing a vector tiles file.
I have patched tilelive-tm{style,source} to use the latest carto (0.17.2).
You can test this yourself by checking out the openstreetmap-carto-vector-tiles project and doing
make tessera
(which will serve the tiles after a while).The text was updated successfully, but these errors were encountered: