title: Poor performance on MKMapView clustering in iOS 11
body: <p>I've been using third-party libraries for handling markers clustering. Since iOS 11 has its own implementation, I've decided to move on and remove third-party libraries on behalf "native" implementation.</p>
  
  <p>I've downloaded the example app from WWDC 2017 and follow the same steps, so:</p>
  
  <ul>
  <li>Connect <code>MKMapView</code> Outlet</li>
  <li>Implement <code>MKAnnotation</code> protocol for my model</li>
  <li>Create a <code>MKMarkerAnnotationView</code> for marker's view</li>
  <li>Create a <code>MKMarkerAnnotationView</code> for cluster's view</li>
  <li>Register both annotations on my mapView reference with register(<code>_:forAnnotationViewWithReuseIdentifier:</code>) function</li>
  <li>Add annotations to my map</li>
  </ul>
  
  <p>However, while using third-party libraries everything was fine, with this method I get a very poor performance when I pan on my mapView and change region. CPU usage raises up to 90% while memory seems to stay stable, and I feel delay in moving and sometimes even app crashes. I'm loading about 600 annotations.</p>
  
  <p>Any suggestion?</p>
  
  <p>Here is the code:</p>
  
  <pre><code>class MapViewClusteringViewController: UIViewController, MKMapViewDelegate {
  
    @IBOutlet weak var mapView: MKMapView!
    private var databaseService: LocalDataService!
  
    override func viewDidLoad() {
      super.viewDidLoad()
      mapView.delegate = self
      mapView.register(StopMarker.self, forAnnotationViewWithReuseIdentifier: MKMapViewDefaultAnnotationViewReuseIdentifier)
      mapView.register(StopCluster.self, forAnnotationViewWithReuseIdentifier: MKMapViewDefaultClusterAnnotationViewReuseIdentifier)
  
      databaseService.fetchMarkers { markers in
        mapView.addAnnotation(markers)
      }
    }
  }
  
  class StopMarker: MKMarkerAnnotationView {
    override var annotation: MKAnnotation? {
      willSet {
        clusteringIdentifier = "busStopCluster"
        subtitleVisibility = .adaptive
        markerTintColor = .red
      }
    }
  }
  
  class StopCluster: MKMarkerAnnotationView {
    override init(annotation: MKAnnotation?, reuseIdentifier: String?) {
      super.init(annotation: annotation, reuseIdentifier: reuseIdentifier)
      displayPriority = .defaultHigh
    }
  
    required init?(coder aDecoder: NSCoder) {
      fatalError("init(coder:) has not been implemented")
    }
  
    override var annotation: MKAnnotation? {
      willSet {
        if let cluster = newValue as? MKClusterAnnotation {
          markerTintColor = .green
          glyphText = "\(cluster.memberAnnotations.count)"
        }
      }
    }
  }
  
  class StopAnnotation: NSObject, MKAnnotation {
    var coordinate: CLLocationCoordinate2D
    var title: String?
  
    init(coordinate: CLLocationCoordinate2D, title: String) {
      self.coordinate = coordinate
      self.title = title
    }
  }
  </code></pre>