Skip to content

Significant performance improvements for downloading tiles

James Westman requested to merge jwestman/libshumate:performance into main

I've added sysprof integration to measure the timing of specific important functions, like rendering tiles. It also measures how long it takes to fill the screen with rendered tiles when you move the viewport.

This last measurement revealed a major performance bug: when multiple tiles on the screen use the same data (such as at low zoom levels, and when overzooming), every tile would be re-rendered every time another tile received data. This is (theoretically) a quadratic slowdown.

I fixed the issue by introducing ShumateDataSourceRequest, which still allows us to return multiple times in case the cache hits but is outdated. Each tile will only be re-rendered when its own request notifies of new data. This causes total rendering time for a screen full of 35 z0 tiles to drop from almost 5 seconds to under 500ms on my computer.

Future performance improvements will include rendering tiles in a thread and combining multiple requests for the same data into one.

Merge request reports