mapbox / mapbox-gl-native-ios

Interactive, thoroughly customizable maps for iOS powered by vector tiles and OpenGL
https://www.mapbox.com/mobile/
Other
210 stars 122 forks source link

MapBox on Simulator extremely slow on Xcode 10 #172

Closed pappalar closed 4 years ago

pappalar commented 5 years ago

Hello!

I noticed similar issues opened for Xcode 9 (like mapbox/mapbox-gl-native#10199). I nearly can't use the map in the simulator.

I would like to know if this is a known issue, some settings I need to configure or something else.

I included the map in a view controller:

class MapViewController: UIViewController {

private lazy var mapView: MGLMapView = {
        let mapView = MGLMapView(frame: view.bounds, styleURL: mapBoxUrl)
        mapView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
        // Set the map view's delegate
        mapView.delegate = self
        view.addSubview(mapView)
        return mapView
    }()
}

and the entire controller containing the map is included in another controller via child-parent connection:

func add(child: UIViewController, to parent: UIViewController) {
        parent.addChild(child)
        parent.view.addSubview(child.view)
        child.didMove(toParent: parent)
    }

extension ContainerViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        add(child: mapViewController, to: self)

    }
}

Configuration

Thanks

julianrex commented 5 years ago

Thanks for the report @racer1988.

It looks like you have a minimal setup, so things ought to be ok.

We do have a known issue caused by poor performance of some of the accessibility code, which can be triggered when using the simulator AND window management tools. For example, I had a similar experience when running Magnet.

Are you running anything like this?

fabian-guerra commented 5 years ago

Hi, @racer1988.

I'm using the same Xcode version as you Version 10.1 (10B61) and haven't notice any slowness. Have you tried in a different mac with different conf as yours? Also note that in the comment points that you may have other tools interfering.

pappalar commented 5 years ago

Hi @julianrex @fabian-guerra! Thank you for your replies.

I do not use any window management tool. I don't believe that is the issue.

Please let this issue open:

Keep you posted soon!

pappalar commented 5 years ago

@julianrex @fabian-guerra I did a quick test run and here are some results.

Test results:

1- I can reproduce the issue on my machine, using an empty project. 2- I can reproduce the issue using the standard style. 3- Using my custom style (that has additional layers of data) makes the performances even worse 4- The issue present itself only at lower zoom levels. At zoom level 1 there is practically no issue. at higher zoom levels the lag increase more and more.

Tomorrow I will:

Additional details:

Logs:

{}[General]: GPU Identifier: Apple Software Renderer

Investigation:

It looks to me that the poor performances are because the renderer is not fast enought and fills the main thread to 100% losing scrolling frames:

screenshot 2019-03-07 at 00 15 33
pappalar commented 5 years ago

@julianrex @fabian-guerra I tested this on different machine and settings:

1- Disabling macOS Automatic Graphic Switching feels it improves slightly the performances. 2- Issues seems more prominent with "Hill Shading" (less prominent in a flat area like Berlin, more prominent in the Alps) 3- Custom style makes it close to unusable. Lag and performance issues are visible also with default Style

Here is the bare minimum project: https://github.com/racer1988/MapboxSimulatorLag Note: Token is redacted

Here is a Video of the issue (in the same repo): https://github.com/racer1988/MapboxSimulatorLag/blob/master/lag.mov

pappalar commented 5 years ago

up

luizmello commented 5 years ago

Hi, I'm also have very bad simulator performance. I tested with different machines and different simulators too. When I run the application in a device there is no lag.

In some tests I can notice a very large memory allocation when I set the zoom map between 5 and 15. If I set the zoom to 4 or 16 this issue don't occurs.

stale[bot] commented 4 years ago

This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions.

raho commented 4 years ago

I'm also experiencing poor performance on the simulator. Using Xcode 11.4 In the logs I see: GPU Identifier: Apple Software Renderer

kajensen commented 4 years ago

I'm seeing this issue with the window manager app Magnet (mentioned above). Odd bug.. will this be fixed?

julianrex commented 4 years ago

This was fixed by https://github.com/mapbox/mapbox-gl-native-ios/pull/318, which was included in the iOS 6.0.0 SDK.