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

Avoid expensive expression parsing when drawing symbols #8295

Merged
merged 4 commits into from
Jun 5, 2019

Conversation

mourner
Copy link
Member

@mourner mourner commented May 29, 2019

Prior to this PR, the drawSymbols routine had to reparse any icon/text-size property expressions when performing evaluateSizeForZoom routine. This led to it taking a noticeable time on the main thread.

The main goal of the PR (first 3 commits) is to simplify the sizeData structure used for it so that it only retains the interpolation factor rather than the whole expression property, making it leaner and completely avoiding the need to parse expressions. On a sample profiling of a Streers-v11 style, it shows roughly 5-10% less time for drawSymbols.

The last commit just simplifies the code to make it easier to read.

The Paint/LayerSymbol benchmarks don't show any difference because the overhead only appear when using expression-heavy styles such as Streets-v11. We should update our benchmark to reflect the current style spec usage in a separate PR.

@mourner mourner requested a review from ansis May 29, 2019 17:49
Copy link
Contributor

@ansis ansis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! The benchmark improvement would be good as well

@mourner mourner merged commit e732eaf into master Jun 5, 2019
@mourner mourner deleted the optimize-symbol-size branch June 5, 2019 19:06
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