mapbox-maps-ios icon indicating copy to clipboard operation
mapbox-maps-ios copied to clipboard

Unusual CPU usage on idle

Open kushsolitary opened this issue 3 years ago • 2 comments

Environment

  • Xcode version: 13.4.1
  • iOS version: 15.4.1
  • Devices affected: iPhone 11 Pro
  • Maps SDK Version: 10.4.3

Observed behavior and steps to reproduce

image

As you can see, the updateHeadingOrientationIfNeeded() is being called every second or so, which causes spikes in the CPU usage and energy usage.

Is there a way to stop this from happening?

kushsolitary avatar Jun 11 '22 05:06 kushsolitary

@kushsolitary are you only experiencing this behavior when the location / heading are being displayed?

ZiZasaurus avatar Jun 21 '22 18:06 ZiZasaurus

@kushsolitary are you only experiencing this behavior when the location / heading are being displayed?

I am seeing this without accessing the location/displaying the heading of the user.

kushsolitary avatar Jun 21 '22 19:06 kushsolitary

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.

Any way to address this? We're having to disable the puck for now because it's so high

samskinner32 avatar Jun 09 '23 14:06 samskinner32

The original issue was addressed by limiting the frequency of heading updates impacting the rendering engine. We also planning some following improvements to optimize it further. The puck location usage issue is tracked in https://github.com/mapbox/mapbox-maps-ios/issues/1939#issuecomment-1594398407

OdNairy avatar Jun 16 '23 09:06 OdNairy