Repository: flutter
Issue: [ios] Initializing google map with 'n' markers takes O(n) time to add and blocks the UI during this period
Labels: platform-ios,engine,c: performance,customer: crowd,p: maps,package,has reproducible steps,P2,found in release: 3.9,team-ios,triaged-ios

## Details
Adding / initializing **'n'** markers on google map takes **O(n)** time, and the UI remains freezed during this period. I tested initializing with `10` , `100`, `500` and `1000` markers.
While adding `10` markers was pretty fast , the delay increased along with the number of markers with 1000 markers taking almost 5-15 seconds ! (in profile mode).  

The same code works fine on android , with no delay and is independent of size 'n'. The app reported no delay even in the debug mode. My android app is already live on Play store and no performance issue has been reported so far.

The issue is only with ios.

**Devices Tested :** 

- iPhone 5S (v 12.x)
- ios Simulator (v 13.x)

**Build Modes Tested :**

- debug
- profile

**Package**:
`google_maps_flutter 0.5.28+1`

**Code Snippet** :
```
Marker getMarkerForStation(Station s, {String infoText}) {
    return Marker(
        markerId: MarkerId(s.id),
        infoWindow: infoText == null ? InfoWindow.noText : InfoWindow(title: infoText),
        draggable: false,
        position: LatLng(s.geoLocation.latitude, s.geoLocation.longitude),
        onTap: () => _onTapExistingMarker(s)
  }

Widget _map(BuildContext context, List<Station> quickViewStations) {
    var _stationMarkers = Set.of(showStations.map((s) => getMarkerForStation(s)));
    return GoogleMap(
        markers: _stationMarkers,
        mapType: MapType.normal,
        myLocationEnabled: true,
        myLocationButtonEnabled: false,
        onMapCreated: _onMapCreated,
        mapToolbarEnabled: false,
        initialCameraPosition: CameraPosition(
          target: _currentDeviceLocation,
          zoom: 16.0,
        ),
        onCameraMove: _onCameraMove,
  }
```

<!--
1.  Please tell us exactly how to reproduce the problem you are running into, and how you measured the performance.

2.  Please attach a small application (ideally just one main.dart file) that
     reproduces the problem. You could use https://gist.github.com/ for this.

3.  Switch flutter to master channel and run this app on a physical device
     using profile or release mode. Verify that the performance issue can be
     reproduced there.

     The bleeding edge master channel is encouraged here because Flutter is
     constantly fixing bugs and improving its performance. Your problem in an
     older Flutter version may have already been solved in the master channel.
-->

<!--
     Please tell us which target platform(s) the problem occurs (Android / iOS / Web / macOS / Linux / Windows)
     Which target OS version, for Web, browser, is the test system running?
     Does the problem occur on emulator/simulator as well as on physical devices?
-->

**Target Platform:** ios
**Target OS version/browser:** 12 and above
**Devices:** ios mobile device / simulator

## Logs

<!--
     Run `flutter analyze` and attach any output of that command below.
     If there are any analysis errors, try resolving them before filing this issue.
-->

```
Analyzing cng-eco-connect-flutter...                                    
No issues found! (ran in 5.4s)
```

<!-- Finally, paste the output of running `flutter doctor -v` here, with your device plugged in. -->

```
[✓] Flutter (Channel master, 1.20.0-3.0.pre.51, on Mac OS X 10.15.4 19E2269, locale en-IN)
    • Flutter version 1.20.0-3.0.pre.51 at /Users/bhavyalathabandaru/Documents/Flutter/flutter
    • Framework revision c68758fab1 (6 days ago), 2020-06-24 21:23:02 -0700
    • Engine revision 0c14126211
    • Dart version 2.9.0 (build 2.9.0-18.0.dev d8eb844e5d)

 
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.0)
    • Android SDK at /Users/bhavyalathabandaru/Library/Android/sdk
    • Platform android-30, build-tools 30.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
    ✗ Android licenses not accepted.  To resolve this, run: flutter doctor --android-licenses

[✓] Xcode - develop for iOS and macOS (Xcode 11.5)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.5, Build version 11E608c
    • CocoaPods version 1.9.3

[✓] Android Studio (version 4.0)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 46.0.2
    • Dart plugin version 193.7361
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)

[✓] Connected device (2 available)
    • Bhavya i5s                 • 18dd1363a73d63042f402aa6f63b812fc966a094 • ios • iOS 12.4.4
    • iPhone SE (2nd generation) • 6C4BF3A7-8EC1-4E94-9BCA-850A3F41D170     • ios • com.apple.CoreSimulator.SimRuntime.iOS-13-5 (simulator)

! Doctor found issues in 1 category.
```