Can this very inefficient Google Maps Multiple Markers script be improved?

I believe that if the loop was replaced with hard-coded JavaScript values on the server this would reduce the current five second rendering time. The complete script would be passed to Google and not rely on the browser to loop through the JavaScript array.

The map is rendered quite quickly but the markers take about five seconds to be appear?

Following is the PHP Heredoc string to generate the the first part of the JavaScript loop:

  $bLocations = 'var locations = [';
  $mak1 = '';
  foreach($locationsFromMySqlTable as $id => $lox):
    $tmp = <<< ____TMP
      [ "{$lox[0]}", {$lox[1]}, {$lox[2]}, $id ],

    $bLocations .= $tmp;

    $tmp2 = <<< ____TMP
      marker = new google.maps.Marker({
        position: new google.maps.LatLng({$lox[1]}, {$lox[2]}),
        map: map
    $mak1 .= $tmp2;
  $bLocations .=  '];';