alacarte-maps / alacarte

Renderer for OpenStreetMap tiles.
https://alacarte-maps.github.io/
Other
58 stars 18 forks source link

[renderer] Implement font attributes #23

Closed AMDmi3 closed 11 years ago

AMDmi3 commented 11 years ago

NB: Currently, mapcss grammar always skips whitespace in attribute values, so font-family: "DejaVu Sans" will be parsed as "DejaVuSans". However, cairo ignores it and works fine regardless. If it's needed, I have a patch that fixes grammar to not remove whitespace from attributes.

TheMarex commented 11 years ago

Looks good. Any noticeable performance decrease when using multiple fonts?

If the grammar even skips white spaces when they are inside of ""-marks, that should be fixed. Otherwise you can merge this.

AMDmi3 commented 11 years ago

Looks good. Any noticeable performance decrease when using multiple fonts?

Again, haven't tested. Are there any built-in benchmarks?

If the grammar even skips white spaces when they are inside of ""-marks, that should be fixed. Otherwise you can merge this.

I guess the grammar shouldn't skip spaces in non-"" case as well (only skipping leading and tailing spaces)

TheMarex commented 11 years ago

Usually there is a summary of the average time it took to compute various functions (e.g. renderTiles) when you exit alacarte. If you want to do some micro-benchmarking you can use the TIMER_START / TIMER_STOP / TIMER_MSEC macros. A good data-point is always to let alacarte pre-render from zoomlevel 0 to 18 on a smaller dataset and check the average times in the performance summary. If you want to have in-depth data, you can generate a performance log file with the --performance-log=filename.log CLI option and use one of the scripts in tools/statistics/ to generate various graphs. For example log2bar.py will generate a bar graph and stat2html.py should generate scatter plots.

What you should look for are drastic increases in rendering time when using multiple fonts. It is rather unlikely, but I'm not sure to which extent setting the font multiple times introduces an overhead (as cairo might do some font scaling). Otherwise it is probably good to know how to get some convenient statistics anyway. ;-)

AMDmi3 commented 11 years ago

I see no change in rendering performance at all. 1 thread, 3 tests, z17 and z18, small dataset with bunch of housenumbers rendered in text:

10.8/10.98/10.7, 8.45/8.31/8.3 for master branch 10.7/10.73/10.87, 8.38/8.5/8.35 for fonts branch with 4 fonts (~1/2 of numbers with different font)

for a style which only renders housenumbers:

8.11/8.18/8.15, 6.55/6.52/6.56 master 8.26/8.19/8.29, 6.51/6.52/6.49 fonts