Improving Marker performance – update to ZoomIn Map API
May 7th, 2008We’ve been working with one of clients on marker performance. The problem with markers is they take a long time to load up especially when you add a lot of makers eg. over 100 markers. The performance gets worse when you add polygons or polylines to the map and as you add or remove layers to the map
One of the problems is that the marker class is full of features – Info Windows, shadows, custom icons etc. The browser has to manage all of the DOM objects for the functionality.
To improve the performance, we’ve created a new marker class called GMarkerSimple. The class has a cutdown set of features ie. ‘onclick’ and ‘openInfoWindow’ to improve the speed. We have also introduced a marker cache to ‘cache’ marker objects in memory to improve performance when adding and remove marker layers.
The performance improvement is quite astounding, especially when you compare it to Google.
FireFox 2.0.14
# markers | Gmarker Class | GMarkerSimple Class |
100 | 0.286 secs | 0.085 secs |
300 | 1.207 secs | 0.258 secs |
IE 6.5
# markers | Gmarker Class | GMarkerSimple Class |
100 | 1.322 secs | 0.018 secs |
300 | 5.409 secs | 0.620 secs |
Don’t take our word for it. Try it for yourself – 100 marker test, 300 marker test and the browser killing 1000 marker test !