GMSMapView Energy Impact
Asked Answered
T

3

8

I'm currently using a GMSMapView in my swift app, and the energy impact is never decreasing ( as the CPU usage or Memory usage ).

Did anyone already faced this issue ?

Using Google Maps 2.0.1

Xcode Monitoring

Energy impact

Thielen answered 29/8, 2016 at 15:50 Comment(0)
T
7

I Found the answer myself. It is related to GMSMarker.tracksViewChanges property.

Turning it to false for all added markers has released the CPU.

Thielen answered 26/6, 2018 at 14:41 Comment(0)
B
2

Make false of GMSMarker()'s object property tracksViewChanges & tracksInfoWindowChanges

let placeMarker = GMSMarker()
placeMarker.tracksViewChanges = false
placeMarker.tracksInfoWindowChanges = false

It will bringdown energy impact clock indictor.

Bargeman answered 19/10, 2019 at 19:42 Comment(1)
I was already using tracksViewChanges property but now added tracksInfoWindowChanges as false, and that is showing significant improvement.Delphiadelphic
F
0

I found google maps to consume to much memory as well. Changing tracksViewChanges worked for me as well.

Another approach that I have tried when the rendering was taking to long, is to split the rendering of the markers or views in the map.

You can use the delegate methods of GMSMapView

  • mapViewDidStartTileRendering(_mapView: GMSMapView) and
  • mapViewDidFinishTileRendering(_ mapView: GMSMapView)

to know when the render has finished and add new elements.

Fineable answered 8/8, 2018 at 3:49 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.