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

setData performance decreased in safari compared to v1.0.0 #10187

Closed
mmuelder opened this issue Dec 11, 2020 · 7 comments · Fixed by #10417
Closed

setData performance decreased in safari compared to v1.0.0 #10187

mmuelder opened this issue Dec 11, 2020 · 7 comments · Fixed by #10417
Assignees
Labels
performance ⚡ Speed, stability, CPU usage, memory usage, or power usage

Comments

@mmuelder
Copy link

mmuelder commented Dec 11, 2020

Greetings!

In the current version 2.0.0 (as far as I know actually since 1.10) the performance of setData combined with a moving camera has extremely decreased in comparison to 1.0.0. We only encountered this problem in the safari on iphones and ipads, no other browsers seem to have this issue, at least not in this magnitude. The circle layer in this example is super laggy:

V 1.0.0 (left) versus V 2.0.0 (right)

mapbox1mapbox2
(recorded on safari @ ipad air 2 12.4.1, same problem on all tested iphones)

Steps to Trigger Behavior

Use setData in combination with a moving camera (easeTo), maybe it also has something to do with circle layers.

Link to Demonstration

The code of the examples seen above can be found here:
https://jsbin.com/hagivowiko/edit?html,output

just replace

<script src='https://api.mapbox.com/mapbox-gl-js/v2.0.0/mapbox-gl.js'></script>
<link href='https://api.mapbox.com/mapbox-gl-js/v2.0.0/mapbox-gl.css' rel='stylesheet' />

with

<script src='https://api.mapbox.com/mapbox-gl-js/v1.0.0/mapbox-gl.js'></script>
<link href='https://api.mapbox.com/mapbox-gl-js/v1.0.0/mapbox-gl.css' rel='stylesheet' />

to see the increased performance (in safari).

Expected Behavior

at least the same performance as 1.0.0

Actual Behavior

extremely laggy drawing/update of the circle layer

@mourner mourner added the performance ⚡ Speed, stability, CPU usage, memory usage, or power usage label Dec 11, 2020
@mourner mourner self-assigned this Dec 11, 2020
@stephenheron
Copy link

We are seeing something similar, we were on an old v0.53 version and I upgraded to the latest v2.0 and calls to setData in Safari is a lot slower.

I went back and checked the versions, for us v1.2.1 was speedy but anything past that, the setData performance is pretty bad.

@stephenheron
Copy link

I did a little more debugging and I think commit 5f8f1c2 might be the issue. It is quite a chunky commit so not had time to dig into it yet.

@vitaliyhayda
Copy link

same degraded performance issue in Safari on iOS devices

@mourner
Copy link
Member

mourner commented Feb 26, 2021

Submitted a PR addressing this issue in #10417 — please try it on your use cases and let me know if there are any problems with it!

I did a little more debugging and I think commit 5f8f1c2 might be the issue. It is quite a chunky commit so not had time to dig into it yet.

@stephenheron thanks so much for bisecting to this commit, this made my job fixing this much easier!

@stephenheron
Copy link

@mourner Nice one. I just tried out your fix and it is 100% better now in Safari for me. Can't tell the difference between Safari and Chrome/Firefox whereas before it was very noticeable.

Glad my bisecting was useful, I tried to help further but the code in that commit was very complicated. Thanks for the detailed PR so I can see what was changed and hopefully learn what was going on as it was bugging me that I couldn't figure it out.

@mmuelder
Copy link
Author

mmuelder commented Mar 1, 2021

Where or how do I get a mapbox-gl.js file with the new code from the PR to test it with our application?

@ansis
Copy link
Contributor

ansis commented Mar 24, 2021

@mmuelder This fix is part of v2.2.0-beta.1 which is available on both the cdn and npm

https://github.com/mapbox/mapbox-gl-js/releases/tag/v2.2.0-beta.1

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.

5 participants