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

Share parsed tiles across maps #2951

Closed
lucaswoj opened this issue Aug 5, 2016 · 6 comments
Closed

Share parsed tiles across maps #2951

lucaswoj opened this issue Aug 5, 2016 · 6 comments

Comments

@lucaswoj
Copy link
Contributor

lucaswoj commented Aug 5, 2016

When one page contains many maps which use the similar styles to show the same geographic region we can improve performance by sharing parsed tiles between maps.
#1. Create Globally Unique Tile Identifier

Tiles can be uniquely identified by a hash of their

  • coordinate
  • source's URL or data
  • style layer's id (to accommodate the paintVertexArrays)
  • style layer's type
  • style layer's layout properties
  • style layer's paint properties which are property-functions

I'm not sure how exactly to handle ref families. The easiest solution is to have an entry in the tile cache per layer, not per ref family. Every entry within the same ref family would still point to the same Tile object.

This could replace the existing Tile#id property
#2. Create Shared Tile Cache

The simplest way to implement this is to replace the SourceCache#_cache instance property with a static SourceCache.cache property, keyed by the globally unique tile identifier ☝️. We will need to tweak the cache's retention policy to suit.

We may need to implement this cache as a locking cache to prevent simultaneous requests for the same time from spawning multiple requests.

cc @anandthakker

@lucaswoj lucaswoj changed the title Share parsed tiles across instances of Map Share parsed tiles across maps Aug 5, 2016
@lucaswoj
Copy link
Contributor Author

lucaswoj commented Aug 5, 2016

Related to #899

@anandthakker
Copy link
Contributor

👍

@lucaswoj thinking about this in the context of custom sources, it probably makes sense to implement 1 in a way that allows the Style and the Source to share responsibility for generating a tile's unique id.

@anandthakker
Copy link
Contributor

Hmm -- @lucaswoj right now, for a given coord, the source cache holds one Tile per source--not per style layer. It seems to me like the "tiles" you're describing above are really closer to Buckets.

It almost seems like instead of caching Tiles, we could cache individual Buckets--keyed off of a hash like you described above--and then use them to construct Tiles on the fly... except that Tiles also have stuff like:

  • collisionBoxArray
  • collisionTile
  • symbolInstancesArray
  • symbolQuadsArray
  • featureIndex

I don't yet know enough about how these work to guess whether they would make such a strategy infeasible. What do you think?

@lucaswoj
Copy link
Contributor Author

lucaswoj commented Aug 8, 2016

@anandthakker Ah. Good thinking. We'll need to think a little bigger in terms of the architectural changes needed to support this feature (#2432 would do the trick)

@mourner
Copy link
Member

mourner commented Sep 11, 2019

Closing as stale — not enough interest to pursue this.

@mourner mourner closed this as completed Sep 11, 2019
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

4 participants