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

Simplify tile renderer, improve stitching and caching #463

Merged
merged 4 commits into from
Nov 7, 2019

Conversation

mz8i
Copy link
Contributor

@mz8i mz8i commented Oct 7, 2019

Resolves #438, and contains the following fixes/improvements:

  • tile stitching now uses sharp's composite() rather than multiple overlayWith() calls, which reduces the number of times a .png().toBuffer() sequence is called from 5 to 2. Without precise testing, on a local server this seems to result in a performance improvement at lower zoom levels. An issue was created against sharp (Using resize after composite causes merging of composited images? lovell/sharp#1908) related to a problem with compositing and then resizing which seemingly prevents us from being able to complete the operations in just one pipeline.
  • the re-written tileserver contained an unintended difference comparing to the old implementation, in that the base_light and base_night layers were not being cached. This has now been amended and a mechanism added to not clear these layers on building data edit

mz8i added 4 commits October 7, 2019 13:34
The new method uses the composite() method of sharp
to reduce the number of times a PNG buffer is created.
The number could be further reduced from two to one,
if the issue #1908 from lovell/sharp is resolved so that
composite and resize can be chained without an
intermediate call to .png().toBuffer()
@mz8i mz8i requested a review from tomalrussell October 7, 2019 16:39
@mz8i mz8i changed the base branch from master to develop October 8, 2019 13:32
@mz8i
Copy link
Contributor Author

mz8i commented Oct 9, 2019

Apparently sharp requires to create two processing pipelines in the stitching step (first composite, then resize) so this is the best we can get.

@mz8i mz8i merged commit 24b8b13 into colouring-cities:develop Nov 7, 2019
@mz8i mz8i deleted the feature/simplify-tile-renderer branch December 17, 2019 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant