<!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">
Just for reference:<br>
<br>
I tried to select about 130 items using a regular expression in the
form of EXPRESSION (/^ITEM1|ITEM2|ITEM3|...|ITEM130$/) and rendering
took about 4.5-5 seconds.<br>
<br>
I tried to select the exact same 130 items using "IN" syntax:
EXPRESSION ("[myfield]" IN "ITEM1,ITEM2,ITEM3,...,ITEM130") and the
query took about 8.5-9 seconds.<br>
<br>
The tests were run several times in the same conditions - so the
relative results should be relevant.<br>
<br>
So - performance favors regular expressions :)<br>
<br>
<br>
<br>
Adrian Popa wrote:
<blockquote cite="mid:4A604CE0.3090704@romtelecom.ro" type="cite">
  <meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
Here's how I "fixed" this issue. I ended up regenerating the shapefile
and dbf and adding a separate column with the grouping I desired. Now,
my map file selects from that column, and the syntax is much simpler
(by one or two orders of magnitude). I am happy with the results,
however, I didn't get the chance to try out all the other methods
because of lack of time.<br>
  <br>
Thanks again,<br>
Adrian<br>
  <br>
Adrian Popa wrote:
  <blockquote cite="mid:4A5D740D.10605@romtelecom.ro" type="cite">
    <meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
Hello Steve,<br>
    <br>
I haven't tried out the simplified regex so I don't know if it will be
faster. I will try to test it as part of a speed test of the various
methods...<br>
    <br>
I'm not sure what you mean by writing a temporary set of geometries. Do
you mean adding an index to my data so that I can select it by a
different (grouping) field instead? Unfortunately I can't do that
because the same item can be part of 10-20 groups, so there would not
be an easy way to group items apart from duplicating them in the
shapefile/dbf. I'm not sure if there's a problem if the same feature
appears 12 times in the same shapefile.<br>
    <br>
In the end data reorganizing might be the fastest method available.
Problem is some items will belong to groups dinamically, so I will have
to implement a selection mechanism based on item id...<br>
    <br>
Regards,<br>
Adrian<br>
    <br>
Steve Lime wrote:
    <blockquote cite="mid:4A5C5216.5157.008F.0@dnr.state.mn.us"
 type="cite">
      <pre wrap="">Have you tried a simplified version of your regex? I think you can do:

  EXPRESSION /^ITEM1|ITEM2|ITEM3|ITEM4$/

You might also consider writing a temporary set of geometries if a user will continually display from
that set. In that case your overhead would be in managing the set of features which would be higher
the first time but then very fast to render. Your dynamic portion of the mapfile would reference the
temporary data.

Steve

  </pre>
      <blockquote type="cite">
        <blockquote type="cite">
          <blockquote type="cite">
            <pre wrap="">On 7/14/2009 at 1:15 AM, in message <a
 moz-do-not-send="true" class="moz-txt-link-rfc2396E"
 href="mailto:4A5C2277.80204@romtelecom.ro">&lt;4A5C2277.80204@romtelecom.ro&gt;</a>, Adrian Popa
        </pre>
          </blockquote>
        </blockquote>
      </blockquote>
      <pre wrap=""><!----><a moz-do-not-send="true"
 class="moz-txt-link-rfc2396E"
 href="mailto:adrian_gh.popa@romtelecom.ro">&lt;adrian_gh.popa@romtelecom.ro&gt;</a> wrote:
  </pre>
      <blockquote type="cite">
        <pre wrap="">Hello everyone,

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.
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).
Right now, my expression is built using regular expressions: something like:
*EXPRESSION /^ITEM1$|^ITEM2$|^ITEM3$|^ITEM4$/*
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.

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:
*EXPRESSION ( ([NAME]=="ITEM1") OR ([NAME]=="ITEM2") OR 
([NAME]=="ITEM3") OR ([NAME]=="ITEM4") )*

 From the documentation I see that:
/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.

/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.

Also - have there been significant changes in performance for this issue 
from mapserver 4.10 (I am now migrating to mapserver 5.4)?

Thanks,
Adrian
    </pre>
      </blockquote>
      <pre wrap=""><!---->

  </pre>
    </blockquote>
    <br>
    <pre wrap=""><hr size="4" width="90%">
_______________________________________________
mapserver-users mailing list
<a moz-do-not-send="true" class="moz-txt-link-abbreviated"
 href="mailto:mapserver-users@lists.osgeo.org">mapserver-users@lists.osgeo.org</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext"
 href="http://lists.osgeo.org/mailman/listinfo/mapserver-users">http://lists.osgeo.org/mailman/listinfo/mapserver-users</a>
  </pre>
  </blockquote>
  <br>
  <br>
  <pre wrap="">
<hr size="4" width="90%">
_______________________________________________
mapserver-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:mapserver-users@lists.osgeo.org">mapserver-users@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/mapserver-users">http://lists.osgeo.org/mailman/listinfo/mapserver-users</a>
  </pre>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">-- 
--- 
Adrian Popa
NOC Division
Network Engineer
Divizia Centrul National de Operare Retea
Departament Transport IP &amp; Metro
Compartiment IP Core &amp; Backbone
Phone: +40 21 400 3099
</pre>
</body>
</html>