apneadiving / Google-Maps-for-Rails

Enables easy Google map + overlays creation in Ruby apps
https://apneadiving.github.io/
MIT License
2.26k stars 382 forks source link

Performance issue. #334

Closed sudheer517 closed 11 years ago

sudheer517 commented 11 years ago

I have nearly 2.5 lakhs records in my database. I am passing all records to the markers,the map works fine but it takes so longtime to load nearly 2 minutes.

apneadiving commented 11 years ago

use ajax and pagination

lulalala commented 9 years ago

Using Firefox, and addMarkers with around 200 markers, and it still takes 2 seconds to load.

I think addMarkers call is not the same as addMarkers call mentioned here http://gmaps-utility-library.googlecode.com/svn/trunk/markermanager/release/docs/examples.html

Adding markers collectively using addMarkers() is recommended as it is more efficient.

Could this be a reason?

apneadiving commented 9 years ago

Yes I dont use marker manager library. 2 seconds is a bit long though, do you use ajax to get markers?

lulalala commented 9 years ago

After some investigation, I found out that I can ignore positions outside current bound before I add them in. This reduced the hang-time to a more acceptable level.

This time I did a proper benchmark, and adding 380 markers (and filtering a lot more) takes around 1283 ms. The time does not include ajax http request.