Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

consider rendering offscreen #3

Open
derhuerst opened this issue Apr 26, 2017 · 4 comments
Open

consider rendering offscreen #3

derhuerst opened this issue Apr 26, 2017 · 4 comments

Comments

@derhuerst
Copy link
Contributor

derhuerst commented Apr 26, 2017

I haven't looked at the exact implementation yet, so forgive me if this is already the case.

It would be possible to render the map offscreen, e.g. in a worker process and then display it. By doing this, the UI wouldn't be blocked that long. Scrolling would have to be disabled or a new rendering attempt started (with the new zoom level) on scroll/move events.

@rastapasta
Copy link
Owner

You're very right, right now there is no threading implemented - just a breeze of asynchrony.
Considered it as well and would love to see it implemented at some point!

@derhuerst
Copy link
Contributor Author

btw looking at the source code, it seems really easy to pull out the src/Renderer into a worker. 👍 for the structure!

@derhuerst
Copy link
Contributor Author

Renderer doesn't need output, right?

@rastapasta
Copy link
Owner

rastapasta commented Apr 26, 2017

Well seen, the output is a deprecated left-over from before :)

Next to the time spent on downloading, the main render-bottleneck currently is the initial processing of a fresh vector tile. The layers' features get filtered (no matching style -> out) and indexed via rbush in _loadLayers - its the reason for the performance drop when (int)zoom changes on feature rich 'fresh' areas, even when the tiles are already cached locally.

The Renderer itself currently waits for all corresponding rbush trees to then request all features in the current bbox. Just putting this whole logic in a worker wouldn't change much (as far as i can see), IMHO the downloading&processing logic would be a better match for it. Meaning: instead of the Renderer waiting for all (up to 4) tiles being initially processed, it could incrementally render them as soon as they are processed by a worker. One more dream: if the parent tile in an above zoom level is already rbush'ed in memory, it could be rendererd stretched while the more-detailed zoom-corresponding tiles are processed and rendered as soon as they're available.

That's such a beautiful piece of logic to be implemented :)

[edit: typo]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants