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

remove map.batch and automatically batch style changes #2343

Closed
ansis opened this issue Mar 25, 2016 · 6 comments · Fixed by #2355
Closed

remove map.batch and automatically batch style changes #2343

ansis opened this issue Mar 25, 2016 · 6 comments · Fixed by #2355
Labels
performance ⚡ Speed, stability, CPU usage, memory usage, or power usage

Comments

@ansis
Copy link
Contributor

ansis commented Mar 25, 2016

I think we should automatically batch all style changes that happen between frames. Are there any cases where we wouldn't want to batch style changes?

If changes are automatically batched we can remove map.batch.

@mourner
Copy link
Member

mourner commented Mar 26, 2016

Yes, I think this would be ideal, although implementation may be tricky. cc @scothis

@mourner mourner added the performance ⚡ Speed, stability, CPU usage, memory usage, or power usage label Mar 26, 2016
@scothis
Copy link
Contributor

scothis commented Mar 28, 2016

I think this is safe and good, we're effectively taking methods that were partially sync and partial async and pushing the balance more towards async. It could break a user if they made a mutation and expected to be able to query against it immediately. Given that the stylesheet mutation can still be done sync before deferring the heaving lifting async, this should be fine.

@jfirebaugh
Copy link
Contributor

Yeah, it would be nice to have the style API work like the DOM API: mutations are reflected immediately in subsequent API accessor methods, but as much heavy work as possible is delayed until the next frame tick, at which time duplicate work is coalesced.

@lucaswoj
Copy link
Contributor

I propose that we

  • run batch operations on every frame, efficiently skipping no-ops.
  • modify StyleLayer#cascade to only touch properties that have changed since the last cascade

@jingsam
Copy link
Contributor

jingsam commented Apr 14, 2016

Is this relating to smart setStyle in #1989 and #1341, as the new release v0.17.0?

@lucaswoj
Copy link
Contributor

@jingsam "smart" setStyle is not implemented and being tracked in #1391

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

Successfully merging a pull request may close this issue.

6 participants