-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Optimize and simplify symbol placement code #12351
Conversation
e447445
to
fb33b04
Compare
11c161d
to
59e7d1f
Compare
Hold on while I'm fixing up the last commit... |
5e6b175
to
a5d2ee6
Compare
e5ffa31
to
6cec89d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A first pass! I still have to carefully go through more of the changes. But this looks really good to me already, a lot of nice simplifications.
675a8a1
to
5482556
Compare
049b7eb
to
536db49
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I finished going over the change and left a few more minor comments/questions. But this was a really needed cleanup and glad to see that we can get out some noticeable performance gain at the same time, LGTM!
While I'm out of power and Internet, I'm going to be working offline on optimizing and simplifying symbol placement code, which is terrifyingly complex at the moment and in dire need of cleanup. Will try to do that in self-contained commits and push periodically when I'm back online.
Results
Zooming around z14–16 on
streets-v11
SF with lots of roads in view, looking at profiler results, this PR seems to improve performance of placement along lines by ~40–50%.Before:
After:
Benchmarks don't show a convincing win, just tiny improvements close to statistical noise — I guess they don't hit label-dense areas enough, but it's still an improvement (most diagnostic metrics show a positive change, even if tiny):
The PR also cuts down the bundle size a little (-314 bytes) and improves flow types in a few places around symbol code (replacing
any
with proper typing).Launch Checklist
mapbox-gl-js
changelog:<changelog>Improve performance of text and icon placement.</changelog>