<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; color: rgb(0, 0, 0); font-size: 14px; font-family: Calibri, sans-serif; ">
<div>Thomas,</div>
<div><br>
</div>
<div>Nice work.</div>
<div><br>
</div>
<div>+1</div>
<div><br>
</div>
<div>Mike</div>
<div><br>
</div>
<div>
<div>
<div>
<div>-- </div>
<div>Michael Smith</div>
</div>
<div>US Army Corps</div>
<div>Remote Sensing GIS/Center</div>
</div>
</div>
<div><br>
</div>
<span id="OLK_SRC_BODY_SECTION">
<div style="font-family:Calibri; font-size:11pt; text-align:left; color:black; BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: #b5c4df 1pt solid; BORDER-RIGHT: medium none; PADDING-TOP: 3pt">
<span style="font-weight:bold">From: </span>thomas bonfort <<a href="mailto:thomas.bonfort@gmail.com">thomas.bonfort@gmail.com</a>><br>
<span style="font-weight:bold">Date: </span>Wednesday, April 3, 2013 11:16 AM<br>
<span style="font-weight:bold">To: </span>MapServer Dev Mailing List <<a href="mailto:mapserver-dev@lists.osgeo.org">mapserver-dev@lists.osgeo.org</a>><br>
<span style="font-weight:bold">Subject: </span>[mapserver-dev] [performance] mapserver list expressions<br>
<span style="font-weight:bold">Resent-From: </span>Michael Smith <<a href="mailto:michael.smith@usace.army.mil">michael.smith@usace.army.mil</a>><br>
</div>
<div><br>
</div>
<div>
<div>
<div dir="ltr">While profiling the openstreetmap renderings, I found a relatively low hanging performance speedup related to expressions when doing class filtering. The context relates to when you'd need to apply a given CLASS to multiple attribute values.
<div>Currently, to apply a single class to multiple values of an attribute, you can either use regular expressions, or use the IN operator, like this:<br>
<div><br>
</div>
<div style="">LAYER</div>
<div style="">  ...</div>
<div style="">  CLASSITEM "type"</div>
<div style="">  CLASS</div>
<div style="">    EXPRESSION /primary|secondary|tertiary/  #regular expression on CLASSITEM</div>
<div style="">    EXPRESSION ("[type]" IN "primary,secondary,tertiary") #"complex" parser expression</div>
<div style="">    ...</div>
<div style="">  END</div>
<div style="">END</div>
</div>
<div style=""><br>
</div>
<div style="">Both methods require quite a bit of overhead, either in the regex system calls, or by using quite a few mallocs when going through the IN parser operation.</div>
<div style=""><br>
</div>
<div style="">We can cut down on this overhead by adding a "list" expression type, denoted by the { } delimiters, where the previous layer definition becomes:</div>
<div style=""><br>
</div>
<div style=""> LAYER</div>
<div>  ...</div>
<div>  CLASSITEM "type"</div>
<div>  CLASS</div>
<div>    EXPRESSION {primary,secondary,tertiary}</div>
<div>    ...</div>
<div>  END</div>
<div>END</div>
<div><br>
</div>
<div style="">The modifications to the code are fairly straightforward, and no backwards incompatibilities are expected as this is a new functionality that does not collide with previous mapserver expressions.</div>
<div style="">The changes can be seen here:</div>
<div style=""><a href="https://github.com/tbonfort/mapserver/commit/fae435d17b099485ab6792bfae3a7d8dd8992b4c">https://github.com/tbonfort/mapserver/commit/fae435d17b099485ab6792bfae3a7d8dd8992b4c</a> . (you can ignore the changes to mapparser.*, they correct
 a bug in the IN parser and aren't related to the list operator)</div>
<div style=""><br>
</div>
<div style="">Our parser guru is OK with these changes, so I would like to vote to include this new expression for our 6.4 release.</div>
<div style=""><br>
</div>
<div style="">I'll start with my +1</div>
<div style=""><br>
</div>
<div style="">best regards,</div>
<div style="">thomas</div>
</div>
</div>
</div>
</span>
</body>
</html>