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

Energy Impact Seems Unreasonably High

Open Jason0705 opened this issue 3 years ago • 3 comments

Environment

  • Xcode version: 13.4.1
  • iOS version: 15.4.1
  • Devices affected: iPhone X
  • Maps SDK Version: 10.8.0

Observed behavior and steps to reproduce

I tested with a basic MapView on SwiftUI View. My implementation is very minimal. The energy impact stays at high if the map is not moving. It turns to very high if map is constantly scrolled.

Code screenshots: Screen Shot 2022-09-09 at 4 41 13 PM Screen Shot 2022-09-09 at 4 41 23 PM

Energy impact with map not moving: Screen Shot 2022-09-09 at 4 34 58 PM

Energy impact with map moving: Screen Shot 2022-09-09 at 4 37 07 PM

Expected behavior

A lower energy impact.

Notes / preliminary analysis

Telemetry is disabled.

Jason0705 avatar Sep 09 '22 23:09 Jason0705

Screen Shot 2022-09-12 at 2 07 28 PM

Also noticed the rendering takes a lot of cpu power and causing battery drain and the device to heat up rather quickly.

Jason0705 avatar Sep 12 '22 21:09 Jason0705

@Jason0705 thank you for reporting this behavior to us. I have brought this issue to the larger team and we are investigating the root cause.

ZiZasaurus avatar Sep 13 '22 13:09 ZiZasaurus

@Jason0705 I think what you are observing here is quite normal, Xcode's energy impact measurements are affected quite a bit by the "Display" section making ~60% of the impact. In the screenshot below I measured energy impact of a completely empty app which renders just a plain white view on iPhone 13 Pro Max - and the average energy impact never drops to low: Blank_app

As for the energy impact when moving - it's bit tricky to measure as rendering can vary depending on map style, zoom level, pitch, camera location. Here I recorded two sessions where camera follows a fixed route - one for MapKit and one for Mapbox maps:

MapKit MapboxMaps

The average energy impact looks quite comparable between the two.

If you want to lessen the rendering burden you can try lowering map view's refresh rate(MapView.preferredFrameRateRange/MapView.preferredFramesPerSecond). Another quite energy-heavy component is the GPS module - you can use LocationOptions.desiredAccuracy and LocationOptions.distanceFilter options to configure the default location manager to a less power-hungry mode.

Here's the GPX file that I used to simulate the route - gpxgenerator_path.gpx.zip.

evil159 avatar Sep 27 '22 12:09 evil159