title: Optimizing performance: Google map via PHP, mySQL, and Javascript
body: <p>Based on <a href="http://code.google.com/apis/maps/articles/phpsqlajax.html" rel="nofollow">this</a> tutorial I have built a page which functions correctly. I added a couple of dropdown boxes to the page, and based on <a href="https://groups.google.com/group/google-maps-api/browse_thread/thread/b53e0d9797ea8cb4" rel="nofollow">this snippet</a>, have been able to filter the results accordingly. So, in practice everything is working as it should. However, my question is regarding the efficiency of the proceedure. Right now, the process looks something like this:</p>
  
  <p>1.) Users visits page
  2.) Body onload() is called
  3.) Javascript calls a PHP script, which queries the database (based on criteria passed along via the URL) and exports that query to an XML file.
  4.) The XML file is then parsed via javascript on the users local machine.</p>
  
  <p>For any one search there could be several thousand results (and thus, several thousand markers to place on the map). As you might have guessed, it takes a long time to place all of the markers. I have some ideas to speed it up, but wanted to touch base with experienced users to verify that my logic is sound. I'm open to any suggestions!</p>
  
  <p>Idea #1: Is there a way (and would it speed things up?) to run the query once, generating an XML file via PHP which contained all possible results, store the XML file locally, then do the filtering via javascript?</p>
  
  <p>Idea #2: Create a cron job on the server to export the XML file to a known location. Instead of using "Gdownloadurl(phpfile.php," I would use gdownloadurl(xmlfile.xml). Thus eliminating the need to run a new query every time the user changes the value of a drop down box</p>
  
  <p>Idea #3: Instead of passing criteria back to the php file (via the URL) should I just be filtering the results via javascript before placing the marker on the map?</p>
  
  <p>I have seen a lot of webpages that place tons and tons of markers on a google map and it doesn't take nearly as long as my application. What's the standard practice in a situation like this?</p>
  
  <p>Thanks!</p>
  
  <p>Edit: There may be a flaw in my logic: If I were to export all results to an XML file, how (other than javascript) could I then filter those results?</p>