Repository navigation
Conversation
692b030 to
b7fcaa9
Compare
|
Note that I'm not adding |
b7fcaa9 to
a3c6ef3
Compare
|
A simple |
a3c6ef3 to
a92ca39
Compare
jfirebaugh
left a comment
There was a problem hiding this comment.
👍 on continuing to push forward with this. The increase in verbosity doesn't look too bad to me -- would be worth a 10%+ performance increase.
| ring.every(p => p.x > EXTENT) || | ||
| ring.every(p => p.y < 0) || | ||
| ring.every(p => p.y > EXTENT); | ||
| for (const p of ring) { |
There was a problem hiding this comment.
This isn't testing the same thing. For example, a ring with xs all < 0 should return true, but this logic will return false, because x < 0 ⇒ x <= EXTENT.
a92ca39 to
1963443
Compare
@ansis @jfirebaugh To illustrate this point, here's the nasty bug I found: mapbox-gl-js/src/style/style_layer/line_style_layer.js Lines 134 to 136 in 855b850 Notice that on the third line, Even more fun, this buggy behavior actually inadvertently produced correct results because mapbox-gl-js/src/data/bucket/line_bucket.js Lines 250 to 253 in 855b850 So it took quite a while to figure out why a rewritten, flat version was failing query tests. |
|
@jfirebaugh I completed the first stage — the map still works if I replace |
|
Can you make a benchmark that shows the improvement so far? It would be useful to have one that's not dominated by earcut anyway. |
|
Closing as stale. I'm breaking some of these changes up into different PRs. The first and most important one (for line bucket) is #8303. |

This PR starts our preparation for #5246. To open up a way to a different geometry storage, first we need to get rid of all uses of math methods from @mapbox/point-geometry when processing VT geometry, so that we're not tied to all points being
Pointobjects from that module. This has additional benefits:In my test load of Mapbox Streets on DC z11, doing this in line_bucket.js reduces overall worker-side
Pointallocations from 1579279 to 415265, or by almost 4 times. This doesn't yet have a noticeable effect on the layout benchmark, but I'll try to capture perf more substantially after finishing the PR.This change also makes the code a bit more verbose and less descriptive, but I think the future trade-off is worth it.
Note that I'm not adding equivalent util methods to replace the Point methods, preferring to inline calculations, to avoid intermediary objects in return values. Once the full elimination pass is complete, I'll see if I can reintroduce some util methods for cleaner code if it's possible to do without the overhead.
cc @ansis @jfirebaugh @ChrisLoer
To do
VT-related
Optional
@mapbox/point-geometrydependency, replace with internalPointtypeLaunch Checklist
write tests for all new functionalitydocument any changes to public APIs