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

optimize style recalculation #2141

Closed
ansis opened this issue Feb 18, 2016 · 5 comments
Closed

optimize style recalculation #2141

ansis opened this issue Feb 18, 2016 · 5 comments
Assignees
Labels
performance ⚡ Speed, stability, CPU usage, memory usage, or power usage

Comments

@ansis
Copy link
Contributor

ansis commented Feb 18, 2016

It takes 5-15ms to recalculate the mapbox-streets style. That's way too long for something that runs every frame while zooming.

Style recalculation takes twice as long as the rest of the rendering work done by the cpu:
screen shot 2016-02-17 at 5 36 33 pm

We should have a benchmark for this.

@ansis ansis added the performance ⚡ Speed, stability, CPU usage, memory usage, or power usage label Feb 18, 2016
@lucaswoj
Copy link
Contributor

Looks like _recalculate is unoptimized by Chrome. That's not good.

Let's hold of on any big picture refactoring of the style classes until data-driven styling lands. I have been refactoring them towards the architecture we need for data driven styling, at some performance cost. We can revisit perf afterwards.

@mourner
Copy link
Member

mourner commented Feb 18, 2016

Quick profiling suggests that a heavy slowdown happened between 0.12 and 0.13 after @lucaswoj StyleLayer refactorings. Although in my profiles, Chrome doesn't mark it as unoptimized, it still takes about 3 times more time, which is pretty severe, so we might want to prioritize this.

0.12:
image

0.13:
image

@mourner
Copy link
Member

mourner commented Feb 18, 2016

For reference, the PR in question is #1960 and possibly some follow-up PRs.

mourner added a commit that referenced this issue Mar 4, 2016
Closes #2141. With this commit, style.recalculate takes 3-4x less time
per frame, bringing its performance back to normal. Sample 10s zooming
profile: 2028ms before, 507ms after. cc @lucaswoj @ansis
@mourner
Copy link
Member

mourner commented Mar 4, 2016

Let's hold of on any big picture refactoring of the style classes until data-driven styling lands. I have been refactoring them towards the architecture we need for data driven styling, at some performance cost.

@lucaswoj I looked through the changes in your #1932 data-driven styling PR, and they don't seem to contradict my optimizations in #2221, so let's review and merge the fix!

@lucaswoj
Copy link
Contributor

lucaswoj commented Mar 4, 2016

Thank you for the consideration @mourner. 🙇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance ⚡ Speed, stability, CPU usage, memory usage, or power usage
Projects
None yet
Development

No branches or pull requests

3 participants