mapbox / tile-cover

Generate the minimum number of tiles to cover a geojson geometry
MIT License
189 stars 40 forks source link

Blazing-fast tile merges! #51

Closed mourner closed 9 years ago

mourner commented 9 years ago

Makes tile merging blazingly fast, as discussed in #49. The improvement is huge!

# zoom 9, without merge
scan russia polygon multizoom - z9 - z9 x 75.23 ops/sec ±2.73% (17 runs sampled)

# zoom 0-9, old merge algorithm
scan russia polygon multizoom - z0 - z9 x 0.82 ops/sec ±5.50% (5 runs sampled)

# zoom 0-9, new merge algorithm
scan russia polygon multizoom - z0 - z9 x 55.80 ops/sec ±2.52% (19 runs sampled)

# zoom 8-9, new merge algorithm
scan russia polygon multizoom - z8 - z9 x 54.27 ops/sec ±2.62% (18 runs sampled)

That means 70 times faster for indexing Russian border from z0 to z9. Moreover, merging z0 to z9 is actually a bit faster than z8 to z9! How cool is that? Point proven.

So how about replacing min_zoom option with something like mergeTiles: true, which always goes up to z0?