Performance improvement for markers

Topics: Windows Forms
Apr 11, 2011 at 6:11 AM

A substantial performance improvement can be made by modifying the following especially when dealing wiht a large number of markers 10,000+

 public class GMapMarkerGoogleRed : GMapMarker
      public float? Bearing;

      public GMapMarkerGoogleRed(PointLatLng p)
         : base(p)
         Size = new System.Drawing.Size(Resources.marker.Width, Resources.marker.Height);
         Offset = new Point(-10, -34);


Size = new System.Drawing.Size(Resources.marker.Width, Resources.marker.Height);


Size = new System.Drawing.Size(20,34);

In otherwords use the actual width an height of the marker.

Apr 11, 2011 at 6:28 AM

how much does it actually speeds up?

Apr 11, 2011 at 6:51 AM
Edited Apr 11, 2011 at 6:52 AM

Tons, especially with lots of markers.

With 20,000 without it, it was taking around several seconds to load the markers, with the change less than a second.

An easy comparison is to use the Cross Marker as opposed to a marker that uses the "Size", it's where I first noticed the speed disparity on initialising the markers and chased it back to that.

Apr 11, 2011 at 6:56 AM

i see, then i'll change it

Apr 11, 2011 at 5:41 PM

done :}