I'm creating a website that has has a map (bing maps or google maps doesn't matter) and the markers are requested every second from ajax and placed in the map.I have also a search input that if you type something the markers get filtered by that text.I described shortly with this code:
setInterval(function(){ getMarkers(); }, 1000); //checks for new makers every second
function getMarkers(){
var markers = getAllMarkersByAjax($('#search').val()); //get markers from database by ajax request and by the text in the search input
removeCurrentMarkers(); // loop that removes all the makrers
addMarkers(markers); // loop that adds the new markers
}
Is this the best way?The markers can be to many im afraid that may be a lot of processing.Is there an efficient way to place the markers, filter them, performance?