<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hello Nikolai,<br>
<br>
As far as you know - the Layers/Classes are processed in paralel
(threads)? Would it even be more efficient not to use expressions, but
to use simple string matchings and dynamically generate 10-400 Classes
in a layer (one class per item)?<br>
<br>
What would be the best/most scalable approach?<br>
<br>
Thank you,<br>
Adrian<br>
<br>
Nikolai Nikolov wrote:
<blockquote cite="mid:007f01ca0460$a419b480$0401a8c0@BenefonUK.local"
 type="cite">
  <meta http-equiv="Content-Type" content="text/html; ">
  <meta name="Generator" content="Microsoft Word 11 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]--><o:SmartTagType
 namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="City">
  <o:SmartTagType
 namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="place"><!--[if !mso]>
<style>
st1\:*{behavior:url(#default#ieooui) }
</style>
<![endif]-->
  <style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";
        color:black;}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:Arial;
        color:navy;}
@page Section1
        {size:595.3pt 841.9pt;
        margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.Section1
        {page:Section1;}
-->
  </style><!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
  </o:SmartTagType></o:SmartTagType>
  <div class="Section1">
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;">Hi Adrian,<o:p></o:p></span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;"><o:p> </o:p></span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;">I have used
long EXPRESSION list in the
past, but my data are “static”, so eventually I modified the map
data and removed the polygons I didn’t want to render.<o:p></o:p></span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;"><o:p> </o:p></span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;">I could
suggest to you to use in your map
file several LAYERs or CLASSes to “spread around” long EXPRESSION
lists. Those LAYERs or CLASSes would be identical but for the
EXPRESSION lists. 
You could put a limit of let’s say 10 selected features per CLASS
definition.<o:p></o:p></span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;"><o:p> </o:p></span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;">Best regards,<o:p></o:p></span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;">Nick<o:p></o:p></span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;"><o:p> </o:p></span></font></p>
  <div>
  <div class="MsoNormal" style="text-align: center;" align="center"><font
 color="black" face="Times New Roman" size="3"><span
 style="font-size: 12pt; color: windowtext;" lang="EN-US">
  <hr tabindex="-1" align="center" size="2" width="100%"></span></font></div>
  <p class="MsoNormal"><b><font color="black" face="Tahoma" size="2"><span
 style="font-size: 10pt; font-family: Tahoma; color: windowtext; font-weight: bold;"
 lang="EN-US">From:</span></font></b><font color="black" face="Tahoma"
 size="2"><span
 style="font-size: 10pt; font-family: Tahoma; color: windowtext;"
 lang="EN-US"> <a class="moz-txt-link-abbreviated" href="mailto:mapserver-users-bounces@lists.osgeo.org">mapserver-users-bounces@lists.osgeo.org</a>
[<a class="moz-txt-link-freetext" href="mailto:mapserver-users-bounces@lists.osgeo.org">mailto:mapserver-users-bounces@lists.osgeo.org</a>] <b><span
 style="font-weight: bold;">On Behalf Of </span></b>Adrian Popa<br>
  <b><span style="font-weight: bold;">Sent:</span></b> 14 July 2009
07:15<br>
  <b><span style="font-weight: bold;">To:</span></b>
<a class="moz-txt-link-abbreviated" href="mailto:mapserver-users@lists.osgeo.org">mapserver-users@lists.osgeo.org</a><br>
  <b><span style="font-weight: bold;">Subject:</span></b>
[mapserver-users]
Performance in regular expressions or an alternative way to select a
list of
features</span></font><font color="black"><span
 style="color: windowtext;" lang="EN-US"><o:p></o:p></span></font></p>
  </div>
  <p class="MsoNormal"><font color="black" face="Times New Roman"
 size="3"><span style="font-size: 12pt;"><o:p> </o:p></span></font></p>
  <p class="MsoNormal" style="margin-bottom: 12pt;"><font color="black"
 face="Times New Roman" size="3"><span style="font-size: 12pt;">Hello
everyone,<br>
  <br>
Here's my problem: I'm trying to highlight segments from a line layer
by using
an expression in a specific class. This portion of the mapfile is
dynamically
generated and when it is done, it is sent to mapserver for rendering. <br>
My problem is that I have to select between 10 - 400 features at a time
and I
noticed when I have a lot of features there is a severe performance
degradation
in mapserver (takes a lot of time to render or even times out).<br>
Right now, my expression is built using regular expressions: something
like:<br>
  <b><span style="font-weight: bold;">EXPRESSION
/^ITEM1$|^ITEM2$|^ITEM3$|^ITEM4$/</span></b><br>
This works ok, but as I said has a performance penalty when you reach
~400
items.  My data is selected from a shapefile layer which has about 5500
items.<br>
  <br>
Since I wouldn't be using the regular expressions at full capacity (I'm
matching the full name), I might rewrite the expression using something
like:<br>
  <b><span style="font-weight: bold;">EXPRESSION ( ([NAME]=="ITEM1") OR
([NAME]=="ITEM2") OR ([NAME]=="ITEM3") OR
([NAME]=="ITEM4") )</span></b><br>
  <br>
&gt;From the documentation I see that:<br>
  <i><span style="font-style: italic;">Regular expression with
MapServer work
similarly to string comparison, but allow more complex operation. They
are
slower than pure string comparisons, but might be still faster than
logical
expression. As with the string comparison use regular expressions, a
FILTERITEM
or a CLASSITEM has to defined, respectively.<br>
  <br>
  </span></i>I would like to know if there is an efficient way of
selecting a
list of elements from a layer, or what are your recommendations.<br>
  <br>
Also - have there been significant changes in performance for this
issue from
mapserver 4.10 (I am now migrating to mapserver 5.4)?<br>
  <br>
Thanks,<br>
  <st1:City w:st="on"><st1:place w:st="on">Adrian</st1:place></st1:City><o:p></o:p></span></font></p>
  </div>
</blockquote>
<br>
</body>
</html>