-
Notifications
You must be signed in to change notification settings - Fork 164
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
High Energy Usage #1939
Comments
@OrbitalTech Hi there! One question? Do you have the pulsing animation enabled for the 2D puck? I just noticed that with this animation enabled the CPU is constantly at 40% even with the map idling, which of course affects the energy consumption. Disabling the pulsing animation fixes the high CPU and energy usage. I see that there is an open ticket on this matter: #1191 but I'm not sure if there is somebody looking at it since it's one year old. |
@vladpre92 Hi i actually had the pulsing animation enabled, and just now i tried to disabled to see if it will make any changes or not, and unfortunately id didn't have an impact, GPU Usage is still high as before. |
Thanks for the report. Would you be able to share a small test program that demonstrates the issue? The screenshot is useful but something that can be built in XCode would be better. |
I did not want to open a new issue. But initial load of the map goes from 35 to 50% of CPU usage. Is that normal? |
We are also seeing uncomfortably high CPU usage when we have the user puck enabled. With this line added to our code: map.location.options.puckType = .puck2D(), we sit at 30-40% CPU, but if I leave that line out I'm sitting at 0-4% CPU. Even with disabling the pulsing animation, it didn't seem to bring down the usage. Any way to address this? We're having to disable the puck for now because it's so high |
I tried many other maps, and it seems to me the only one that have like reasonable cpu 30-40% is this mapbox on load. I never use that puck thingy. I am using like simple locationService->getuserlocation->add (or update geojson source for last location) circle layer. |
Thank you all for providing such detailed reports. We greatly appreciate your efforts in bringing the high CPU usage issue with the Mapbox Maps SDK to our attention. Rest assured, we are fully aware of the problem and have already added it to our backlog for investigation and resolution. However, at this moment, we do not have an estimated time of completion (ETA) for this issue. In the meantime, we would like to suggest a few known workarounds that you can implement on the application side to mitigate the problem:
We hope these workarounds will provide some relief while we work on a permanent solution for the high CPU usage issue. We truly appreciate your patience and understanding in this matter. Please feel free to reach out to us if you have any further questions or concerns. |
@OdNairy Do you have any code examples of how to best implement the above workarounds? |
@OdNairy It's been 5 months since ticket opening, do you have any estimate now? Is there a release number this fix is scheduled for? |
@OdNairy Any updates? |
* Remove internal topics * Move Core and Common Internals to Separate Section * Updates based on review
At the very least the puck animation should be disabled by default with clear warnings in the API that this can cause 30+% CPU usage. This was a simple fix to disable the pulsing, but I've been dealing with this for months without realizing the culprit. It's causing lots of CPU usage during debugging and probably worse on people's phones. Still happening on Mapbox v11.4.0 |
@OdNairy It's been almost TWO YEARS since the ticket was opened. Any plans or timeline for fixing it? |
I'm experiencing the same issue. Do you have any plans to address it? |
Environment
Observed behavior and steps to reproduce
Using SwiftUI i am showing a MapBox Map on my main screen, when presented in xcode energy report i have noticed a very high energy usage coming from using to much GPU after hours of debugging i have finally found out that this behavior happens because of mapbox is being re-rendered way too much, i have used the same implementation as their SwiftUI Example, but i am displaying user location on the map and changing the camera when the user moves, additionally i have implemented Apple Maps and Google Maps to see if its General issue with swiftUI or not, and No its specific to MapBox.
So here are some screenshot of whem i am presenting Mapbox and when i remove just the map layer
When i am displaying the map Notice the GPU Usage:

When i remove just the Map Layer Notice how the GPU Usage drops:

Alternatively using Apple Map Or Google Map doesn't use that much GPU.
Expected behavior
Notes / preliminary analysis
So after digging up a little bit more i noticed that with MapBox For some reason calling updateUIView() in the UIViewRepresentable protocol is being called endlessly and very fast which made me think that the GPU usage is because the UI is being redrawn way too much which i am not sure why since with the other map that i experimented with that was not an issue
The text was updated successfully, but these errors were encountered: