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

Faster and more correct tile fraction calculation #22

Merged
merged 1 commit into from
Sep 2, 2015

Conversation

mourner
Copy link
Member

@mourner mourner commented Sep 2, 2015

Makes the tile fraction calculation more correct (IMO) since it's now a direct projection rather than a combination of projection and linear interpolation inside a tile. It's also much much faster because it doesn't do unnecessary work.

Interestingly, this also addresses the discrepancy between Node 0.10 and 0.12 described here mapbox/tile-cover#63 (comment) — after this fix, tile-cover will behave in 0.10 exactly like in 0.12.

cc @morganherlocker

@mourner
Copy link
Member Author

mourner commented Sep 2, 2015

It's so much faster that it makes tile-cover 1.5-2 times faster as a result:

# with this tilebelt patch
scan point - z6 - z6 x 6,650,813 ops/sec ±2.49% (23 runs sampled)
scan road - z6 - z6 x 239,385 ops/sec ±3.63% (22 runs sampled)
scan road - z8 - z8 x 234,069 ops/sec ±4.15% (21 runs sampled)
scan road - z10 - z10 x 231,450 ops/sec ±4.37% (20 runs sampled)
scan road - z12 - z12 x 239,066 ops/sec ±3.86% (21 runs sampled)
scan road - z18 - z18 x 35,166 ops/sec ±2.80% (22 runs sampled)
scan road - z20 - z20 x 15,179 ops/sec ±1.83% (22 runs sampled)
scan road - z25 - z25 x 192 ops/sec ±2.38% (20 runs sampled)
scan road - z28 - z28 x 40.59 ops/sec ±4.34% (15 runs sampled)
scan building - z6 - z6 x 95,254 ops/sec ±1.64% (22 runs sampled)
scan building - z8 - z8 x 90,872 ops/sec ±3.29% (21 runs sampled)
scan building - z10 - z10 x 93,993 ops/sec ±1.46% (23 runs sampled)
scan building - z12 - z12 x 94,611 ops/sec ±2.98% (22 runs sampled)
scan building - z18 - z18 x 49,377 ops/sec ±1.71% (20 runs sampled)
scan building - z20 - z20 x 17,095 ops/sec ±6.78% (21 runs sampled)
scan building - z25 - z25 x 54.95 ops/sec ±3.22% (16 runs sampled)
scan building - z28 - z28 x 4.60 ops/sec ±8.03% (7 runs sampled)
scan russia polygon - z6 - z6 x 2,270 ops/sec ±3.06% (20 runs sampled)
scan russia polygon - z8 - z8 x 301 ops/sec ±2.19% (21 runs sampled)
scan russia polygon - z10 - z10 x 23.05 ops/sec ±6.52% (12 runs sampled)
scan russia polyline - z6 - z6 x 6,711 ops/sec ±2.03% (22 runs sampled)
scan russia polyline - z8 - z8 x 2,381 ops/sec ±2.31% (22 runs sampled)
scan russia polyline - z10 - z10 x 634 ops/sec ±2.43% (22 runs sampled)
scan russia polygon multizoom - z0 - z9 x 58.56 ops/sec ±3.61% (16 runs sampled)

# without the patch
scan point - z6 - z6 x 4,798,890 ops/sec ±1.50% (23 runs sampled)
scan road - z6 - z6 x 149,938 ops/sec ±2.87% (20 runs sampled)
scan road - z8 - z8 x 148,930 ops/sec ±3.35% (23 runs sampled)
scan road - z10 - z10 x 153,403 ops/sec ±2.92% (22 runs sampled)
scan road - z12 - z12 x 153,565 ops/sec ±3.08% (19 runs sampled)
scan road - z18 - z18 x 31,702 ops/sec ±3.01% (22 runs sampled)
scan road - z20 - z20 x 16,745 ops/sec ±1.55% (24 runs sampled)
scan road - z25 - z25 x 198 ops/sec ±2.50% (21 runs sampled)
scan road - z28 - z28 x 41.28 ops/sec ±5.27% (15 runs sampled)
scan building - z6 - z6 x 57,995 ops/sec ±2.36% (23 runs sampled)
scan building - z8 - z8 x 59,613 ops/sec ±1.83% (20 runs sampled)
scan building - z10 - z10 x 59,473 ops/sec ±1.61% (23 runs sampled)
scan building - z12 - z12 x 59,990 ops/sec ±3.07% (22 runs sampled)
scan building - z18 - z18 x 36,311 ops/sec ±1.33% (21 runs sampled)
scan building - z20 - z20 x 15,687 ops/sec ±4.06% (24 runs sampled)
scan building - z25 - z25 x 60.63 ops/sec ±2.79% (17 runs sampled)
scan building - z28 - z28 x 5.16 ops/sec ±3.96% (7 runs sampled)
scan russia polygon - z6 - z6 x 1,969 ops/sec ±1.77% (23 runs sampled)
scan russia polygon - z8 - z8 x 319 ops/sec ±2.45% (22 runs sampled)
scan russia polygon - z10 - z10 x 23.30 ops/sec ±5.62% (12 runs sampled)
scan russia polyline - z6 - z6 x 3,757 ops/sec ±1.38% (22 runs sampled)
scan russia polyline - z8 - z8 x 1,835 ops/sec ±2.13% (22 runs sampled)
scan russia polyline - z10 - z10 x 610 ops/sec ±2.20% (22 runs sampled)
scan russia polygon multizoom - z0 - z9 x 58.39 ops/sec ±3.38% (16 runs sampled)

@morganherlocker morganherlocker merged commit 7e06ad9 into master Sep 2, 2015
@morganherlocker morganherlocker deleted the tile-fraction branch September 2, 2015 18:30
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.

2 participants