title: Slow performance from MapServer
body: <p>I'm using mapserver to create a map that will be displayed with the google map api. I'm encountering performances issues.</p>
  
  <p>My maps are all in shapefile format.</p>
  
  <p>I run tests to get time to render maps.</p>
  
  <p>When rendering a map with the shp2img tool, using command line</p>
  
  <pre><code>shp2img -i gif -m C:\myfolder\mymapfile.map -o C:\myfolder\test.gif -all_debug 5 -map_debug 5
  </code></pre>
  
  <p>I get the following metrics from the log files:</p>
  
  <pre><code>[Thu Apr 30 13:50:19 2009].148000 msLoadMap(): 0.000s
  [Thu Apr 30 13:50:19 2009].180000 msDrawMap(): Layer 0 (PWorld2), 0.032s
  [Thu Apr 30 13:50:19 2009].180000 msDrawMap(): Drawing Label Cache, 0.000s
  [Thu Apr 30 13:50:19 2009].180000 msDrawMap() total time: 0.032s
  [Thu Apr 30 13:50:19 2009].195000 msSaveImage() total time: 0.015s
  [Thu Apr 30 13:50:19 2009].195000 msFreeMap(): freeing map at 01595E18.
  [Thu Apr 30 13:50:19 2009].195000 freeLayer(): freeing layer at 0159CD00.
  [Thu Apr 30 13:50:19 2009].195000 shp2img total time: 0.047s
  </code></pre>
  
  <p>When rendering the same map through mapserver, using </p>
  
  <pre><code>http://localhost/cgi-bin/mapserv.exe?mymapfile.map&amp;layers=&amp;mode=tile&amp;tilemode=gmap&amp;tile=1+1+2
  </code></pre>
  
  <p>log file is giving this:</p>
  
  <pre><code>[Thu Apr 30 13:51:50 2009].664000 CGI Request 1 on process 3520
  [Thu Apr 30 13:51:50 2009].664000 msTileSetExtent (-10013744.792915, 8348.961808) (-5009.377085, 10010405.208192)
  [Thu Apr 30 13:51:51 2009].23000 msDrawMap(): Layer 0 (PWorld2), 0.359s
  [Thu Apr 30 13:51:51 2009].23000 msDrawMap(): Drawing Label Cache, 0.000s
  [Thu Apr 30 13:51:51 2009].23000 msDrawMap() total time: 0.359s
  [Thu Apr 30 13:51:51 2009].23000 msSaveImage() total time: 0.000s
  [Thu Apr 30 13:51:51 2009].23000 mapserv request processing time (loadmap not incl.): 0.359s
  [Thu Apr 30 13:51:51 2009].23000 msFreeMap(): freeing map at 01598690.
  </code></pre>
  
  <p>For the same map, the shp2img tool is rendering map 10 times faster than mapserver.  When adding more layers and using the tiling mode for google map, can be up to 10 seconds.</p>
  
  <p>Is somebody knows why mapserver is rendering this slow?  Is there a workaround?</p>