Googlemap api v3 slower than api v2?

2020-07-17 15:32发布

问题:

I am in the midst of converting old googlemap v2 code to v3 and it looks if v3 is much slower than v2?

Most of my code change is just replacing G with google.maps. (GMarker to google.maps.Marker)

Any tips or tricks how to speed things up??

回答1:

The solution might be as simple as experimenting with different versions of the v3 API by trying v=3.4 and v=3.5 in your links that load the API like so:

<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false&v=3.5"></script>

And:

<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false&v=3.4"></script>

On a site I built, the product manager felt that Streetview in particular was sluggish in 3.6. When I rolled it back to 3.5, he felt that it was a noticeable improvement.



回答2:

Don't use it unless you really need it. Never change a running system. Maybe you want to write a better marker solution with a better clustering (spatial index, quadtree, heatmap)? I.e. Google's fusion table doesn't support a spatial index. You want to look for Nick's spatial index hilbert curve quadtree blog.



回答3:

My problem probably was with using FireBug - then the V3 api is loading slower than V2. Also, switching between satellite and normal map makes slow fade effect when FireBug is on.