<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.5945" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN 
class=394202309-03092010>Hi,</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN 
class=394202309-03092010></SPAN></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN 
class=394202309-03092010>I guess that classification has a big effect in your 
case.&nbsp; I have been reading that string comparisons are faster than logical 
ones.&nbsp; How about to have a try by classifying your shapefile and writing 
the classes&nbsp;directly to a new attribute field?&nbsp;</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN 
class=394202309-03092010></SPAN></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN 
class=394202309-03092010>This is my&nbsp;scale dependent group, simplified and 
spiced with&nbsp;some &nbsp;typos, I fear.&nbsp; </SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN 
class=394202309-03092010></SPAN></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN 
class=394202309-03092010>LAYER<BR>&nbsp;&nbsp;&nbsp;&nbsp; GROUP "Parcels"&nbsp; 
<BR>&nbsp;&nbsp;&nbsp;&nbsp; NAME "all_parcels"<BR>&nbsp;&nbsp;&nbsp;&nbsp; TYPE 
POLYGON<BR>&nbsp;&nbsp;&nbsp;&nbsp; STATUS ON<BR>&nbsp;&nbsp;&nbsp;&nbsp; DATA 
"parcels_2008"<BR>&nbsp;&nbsp;&nbsp;&nbsp; UNITS 
METERS<BR>&nbsp;&nbsp;&nbsp;&nbsp; MAXSCALEDENOM 
100000<BR>&nbsp;&nbsp;&nbsp;&nbsp; CLASS<BR>&nbsp;&nbsp;&nbsp;&nbsp; NAME 
"parcel_class"<BR>&nbsp;&nbsp;&nbsp;&nbsp; STYLE<BR>&nbsp;&nbsp;&nbsp;&nbsp; 
&nbsp; OUTLINECOLOR 250 0 180<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WIDTH 
2<BR>&nbsp;&nbsp;&nbsp;&nbsp; END&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp; 
END<BR>&nbsp;&nbsp;&nbsp;&nbsp; METADATA<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
"ows_include_items" "AREA, PERIMETER"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
"wms_title"&nbsp;&nbsp;&nbsp; 
"all_parcels"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "wms_srs" "EPSG:2393 
EPSG:3067 EPSG:4326 EPSG:900913"<BR>&nbsp;&nbsp;&nbsp;&nbsp; 
END<BR>&nbsp;&nbsp;&nbsp;&nbsp; 
PROJECTION<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "init=epsg:2393" 
<BR>&nbsp;&nbsp;&nbsp;&nbsp; END<BR>&nbsp;&nbsp; END 
<BR>LAYER<BR>&nbsp;&nbsp;&nbsp;&nbsp; GROUP "Parcels"&nbsp; 
<BR>&nbsp;&nbsp;&nbsp;&nbsp; NAME "ten_percent"<BR>&nbsp;&nbsp;&nbsp;&nbsp; TYPE 
POLYGON<BR>&nbsp;&nbsp;&nbsp;&nbsp; STATUS ON<BR>&nbsp;&nbsp;&nbsp;&nbsp; DATA 
"parcels_2008_0"<BR>&nbsp;&nbsp;&nbsp;&nbsp; UNITS 
METERS<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MAXSCALEDENOM 
1000000<BR>&nbsp;&nbsp;&nbsp;&nbsp; MINSCALEDENOM 
100000<BR>&nbsp;&nbsp;&nbsp;&nbsp; CLASS<BR>&nbsp;&nbsp;&nbsp;&nbsp; NAME 
"parcel_class"<BR>&nbsp;&nbsp;&nbsp;&nbsp; 
STYLE<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OUTLINECOLOR 250 0 
180<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WIDTH 2<BR>&nbsp;&nbsp;&nbsp;&nbsp; 
END&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp; END<BR>&nbsp;&nbsp;&nbsp;&nbsp; 
METADATA<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "ows_include_items" "AREA, 
PERIMETER"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "wms_title"&nbsp;&nbsp;&nbsp; 
"ten_percent"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "wms_srs" "EPSG:2393 
EPSG:3067 EPSG:4326 EPSG:900913"<BR>&nbsp;&nbsp;&nbsp;&nbsp; 
END<BR>&nbsp;&nbsp;&nbsp;&nbsp; 
PROJECTION<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "init=epsg:2393" 
<BR>&nbsp;&nbsp;&nbsp;&nbsp; END<BR>&nbsp;&nbsp; END 
<BR>LAYER<BR>&nbsp;&nbsp;&nbsp;&nbsp; GROUP "Parcels"&nbsp; 
<BR>&nbsp;&nbsp;&nbsp;&nbsp; NAME "one_percent"<BR>&nbsp;&nbsp;&nbsp;&nbsp; TYPE 
POLYGON<BR>&nbsp;&nbsp;&nbsp;&nbsp; STATUS ON<BR>&nbsp;&nbsp;&nbsp;&nbsp; DATA 
"parcels_2008_00"<BR>&nbsp;&nbsp;&nbsp;&nbsp; UNITS 
METERS<BR>&nbsp;&nbsp;&nbsp;&nbsp; MINSCALEDENOM 
1000000<BR>&nbsp;&nbsp;&nbsp;&nbsp; CLASS<BR>&nbsp;&nbsp;&nbsp;&nbsp; NAME 
"parcel_class"<BR>&nbsp;&nbsp;&nbsp;&nbsp; 
STYLE<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # COLOR&nbsp; 240 240 
0<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OUTLINECOLOR 250 0 
180<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WIDTH 2<BR>&nbsp;&nbsp;&nbsp;&nbsp; 
END&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp; END<BR>&nbsp;&nbsp;&nbsp;&nbsp; 
METADATA<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "ows_include_items" "AREA, 
PERIMETER"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "wms_title"&nbsp;&nbsp;&nbsp; 
"one_percent"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "wms_srs" "EPSG:2393 
EPSG:3067 EPSG:4326 EPSG:900913"<BR>&nbsp;&nbsp;&nbsp;&nbsp; 
END<BR>&nbsp;&nbsp;&nbsp;&nbsp; 
PROJECTION<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "init=epsg:2393" 
<BR>&nbsp;&nbsp;&nbsp;&nbsp; END<BR>&nbsp;&nbsp; END 
<BR>LAYER</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff 
size=2></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=394202309-03092010><FONT face=Arial 
color=#0000ff size=2>-Jukka-</FONT></SPAN></DIV><FONT face=Arial color=#0000ff 
size=2></FONT><FONT face=Arial color=#0000ff size=2></FONT><FONT face=Arial 
color=#0000ff size=2></FONT><FONT face=Arial color=#0000ff size=2></FONT><FONT 
face=Arial color=#0000ff size=2></FONT><BR>
<BLOCKQUOTE dir=ltr 
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
  <DIV class=OutlookMessageHeader lang=fi dir=ltr align=left>
  <HR tabIndex=-1>
  <FONT face=Tahoma size=2><B>Lähettäjä:</B> Chris Jackson 
  [mailto:webturtles@gmail.com] <BR><B>Lähetetty:</B> 3. syyskuuta 2010 
  12:13<BR><B>Vastaanottaja:</B> Rahkonen Jukka<BR><B>Kopio:</B> 
  mapserver-users@lists.osgeo.org<BR><B>Aihe:</B> Re: [mapserver-users] Display 
  performance<BR></FONT><BR></DIV>
  <DIV></DIV>Hi Jukka<BR><BR>Thanks for the response and the great investigative 
  work!<BR>My log entry for drawing the layer is - [Fri Sep 03 10:01:25 
  2010].658000 msDrawMap(): Layer 1 (meanspringpeakflow), 24.500s. :o(<BR><BR>I 
  do wonder if my Mapfile layer definition is just v.poor (admittedly no 
  expert!) so have taken an excerpt of the layer defintion (there are about 15 
  classes in all) - views anyone, should I be loading it a different 
  way?<BR><BR>Also Jukka, could I get a sample of your <SPAN 
  style="COLOR: rgb(51,0,51)"><FONT face=Arial size=2>scale dependent WMS GROUP 
  layer map code - as it sounds like a great idea maybe for this but also some 
  v.hi-res model grids I am thinking about.</FONT></SPAN><BR><BR>Thanks again, 
  much appreciated!<BR>Chris<BR><BR>LAYER<BR>&nbsp; NAME 
  "meanspringpeakflow"<BR>&nbsp; TYPE polygon <BR>&nbsp; DEBUG 5 <BR>&nbsp; DATA 
  "Tide"<BR>&nbsp; TEMPLATE void<BR>&nbsp; PROJECTION<BR>&nbsp;&nbsp; "+proj=utm 
  +zone=31 +ellps=GRS80 +units=m +no_defs"&nbsp; <BR>&nbsp; END<BR>&nbsp; 
  METADATA <BR>&nbsp;&nbsp;&nbsp; "DESCRIPTION" "Mean Spring Peak 
  Flow"<BR>&nbsp;&nbsp;&nbsp; "RESULT_FIELDS" 
  "ID,DISTANCE,DEPTH,MEAN_SP_PC"<BR>&nbsp;&nbsp;&nbsp; "RESULT_HEADERS" 
  "ID,Minimum Distance (m),Average Depth (m),Mean Spring Peak Flow 
  (m/s)"<BR>&nbsp;&nbsp;&nbsp; "ows_title"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  "meanspringpeakflow"<BR>&nbsp;&nbsp;&nbsp; "RESULT_HYPERLINK" "ID|| Load 
  graphing tool"<BR>&nbsp; END&nbsp; # Metadata <BR>&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp; CLASS<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp; NAME '&gt; 4.00 (m/s) '<BR>&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; EXPRESSION ([MEAN_SP_PC] &gt;= 4 AND 
  [MEAN_SP_PC] &lt; 4.5) <BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp; STYLE<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; COLOR 135 99 64<BR>&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; END #end style<BR>&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp; END # end class<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
  CLASS<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; NAME '3.51 - 
  4.00'<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; EXPRESSION 
  ([MEAN_SP_PC] &gt;= 3.5 AND [MEAN_SP_PC] &lt; 4) <BR>&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; STYLE<BR><BR>&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; COLOR 158 126 
  63<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; END #end 
  style<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; END # end class<BR>etc 
  etc<BR><BR><BR>
  <DIV class=gmail_quote>On 3 September 2010 09:04, Rahkonen Jukka <SPAN 
  dir=ltr>&lt;<A 
  href="mailto:Jukka.Rahkonen@mmmtike.fi">Jukka.Rahkonen@mmmtike.fi</A>&gt;</SPAN> 
  wrote:<BR>
  <BLOCKQUOTE class=gmail_quote 
  style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
    <DIV>
    <DIV dir=ltr align=left><FONT face=Arial color=#0000ff 
    size=2><SPAN>Hi,</SPAN></FONT></DIV>
    <DIV dir=ltr align=left><FONT face=Arial color=#0000ff 
    size=2><SPAN></SPAN></FONT>&nbsp;</DIV>
    <DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN>I took 
    some numbers to compare with.</SPAN></FONT></DIV>
    <DIV dir=ltr align=left><FONT face=Arial color=#0000ff 
    size=2><SPAN></SPAN></FONT>&nbsp;</DIV>
    <DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN>Material 
    and methods</SPAN></FONT></DIV>
    <DIV dir=ltr align=left><FONT face=Arial color=#0000ff 
    size=2><SPAN></SPAN></FONT>&nbsp;</DIV>
    <DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN>Polygon 
    layer, rather simple polygons with few vertises, Feature Count: 
    117383</SPAN></FONT></DIV>
    <DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN>DEBUG 5 
    in mapfile</SPAN></FONT></DIV>
    <DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN>WMS 
    client asks for the whole layer</SPAN></FONT></DIV>
    <DIV><FONT face=Arial color=#0000ff size=2><SPAN>Mapserver 5.2.1 (CGI) on 
    not so fast Windows computer</SPAN></FONT><FONT face=Arial color=#0000ff 
    size=2></FONT><BR></DIV>
    <DIV><SPAN><FONT face=Arial color=#0000ff size=2>Results</FONT></SPAN></DIV>
    <DIV><SPAN><FONT face=Arial color=#0000ff size=2>First request: rendering 
    time taken from&nbsp;the log file are between 3.5 and 4.5 
    seconds</FONT></SPAN></DIV>
    <DIV><SPAN><FONT face=Arial color=#0000ff size=2>Following request, BBOX is 
    changing but all the polygons are drawn though:&nbsp; rendering times 1.5 - 
    2.5 seconds</FONT></SPAN></DIV>
    <DIV><SPAN><FONT face=Arial color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
    <DIV><SPAN><FONT face=Arial color=#0000ff size=2>Conclusions and 
    discussion</FONT></SPAN></DIV>
    <DIV><SPAN><FONT face=Arial color=#0000ff size=2>At first one might think 
    that my server is faster.&nbsp;&nbsp;But this test is not controlled at all 
    because we are not using the same shapefiles and we can't say so. 
    What&nbsp;we can say&nbsp;that a couple of hundred of thousand polygons can 
    be drawn faster.&nbsp; </FONT></SPAN></DIV>
    <DIV><SPAN><FONT face=Arial color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
    <DIV><SPAN><FONT face=Arial color=#0000ff size=2>However, it does not really 
    make sense to render an image this way if it should be fast.&nbsp; If the 
    screen has 1000 by 1000 pixels it makes a million pixels together.&nbsp; For 
    200000 polygons it makes 5 pixels per polygon.&nbsp; You can simplify your 
    polygon geometries&nbsp;pretty much before anybody can see the 
    differense.&nbsp;&nbsp;If the polygons are spread evenly nobody can even see 
    the difference if there are 20000 or&nbsp;200000 polygons on the 
    screen.</FONT></SPAN></DIV>
    <DIV><SPAN><FONT face=Arial color=#0000ff size=2></FONT></SPAN><SPAN><FONT 
    face=Arial color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
    <DIV><SPAN><FONT face=Arial color=#0000ff size=2>We have one polygon layer 
    with about million polygons and for that I made two&nbsp;simplified layers 
    which contain only 1 percent and 10 percent of all the polygons.&nbsp; Those 
    and the original shapefile&nbsp;are put into the same scale dependent WMS 
    GROUP layer.&nbsp;This group is pretty fast at any scale.&nbsp; The 1 
    percent layer is perhaps a bit too sparse but I have been too lazy to have a 
    try with 2 or 5 percent samples.</FONT></SPAN></DIV>
    <DIV><SPAN><FONT face=Arial color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
    <DIV><SPAN><FONT face=Arial color=#0000ff size=2>-Jukka 
    Rahkonen-</FONT></SPAN></DIV></DIV></BLOCKQUOTE></DIV></BLOCKQUOTE></BODY></HTML>