<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.3395" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2>Folks -
</FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff
size=2></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial><FONT color=#0000ff><FONT
size=2>After <SPAN class=096121117-15092008>seeing the </SPAN>thread
on <SPAN class=096121117-15092008>e</SPAN>vals <SPAN
class=096121117-15092008>hurting performance </SPAN>a couple of weeks ago<SPAN
class=096121117-15092008>, I tried to remove them from a rule
set we are using (running Drools 4.0.4), and have had
limited success.</SPAN></FONT></FONT></FONT><FONT face=Arial color=#0000ff
size=2></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff
size=2></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=096121117-15092008>An example is shown below. We're using evals
every time we make a call to "rulesUtil", a helper class we have for checking
strings for keywords. Two questions:</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=096121117-15092008></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=096121117-15092008>1. Does using inline evals (like below) hurt
performance as much as using non-inline evals?</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=096121117-15092008>2. If so, any thoughts for how to rewrite this
rule to avoid using the eval?</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff
size=2></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff
size=2></FONT> </DIV><FONT color=#0000ff size=2><FONT color=#960000 size=1>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff
size=2>rule</FONT></FONT><FONT face=Arial> 'my rule'</FONT></DIV>
<DIV dir=ltr align=left><B><FONT color=#960000><FONT
face=Arial>salience</FONT></B></FONT><FONT face=Arial> 790</FONT></DIV>
<DIV dir=ltr align=left><B><FONT color=#960000><FONT
face=Arial>activation-group</FONT></B></FONT><FONT face=Arial> <FONT
color=#008000>"priorityRule"</DIV></FONT></FONT>
<DIV dir=ltr align=left><B><FONT color=#960000><FONT
face=Arial>when</FONT></DIV></B></FONT>
<DIV dir=ltr align=left><FONT face=Arial>ruleUtil : RulesUtil( )</FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial>s1 : Sensor( source == <FONT
color=#008000>"X</FONT>, $rfp : RFP , <B><FONT
color=#960000>eval</B></FONT></FONT><FONT face=Arial>(
ruleUtil.containsKeywordString($rfp, <FONT color=#008000>"Y"</FONT> )<SPAN
class=096121117-15092008>)</SPAN> , $tcn : TCN)</FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial>s2 : Sensor( TCN != $tcn, source ==
<FONT color=#008000>"Z"</FONT></FONT></DIV>
<DIV dir=ltr align=left><B><FONT color=#960000><FONT
face=Arial>then</FONT></DIV></B></FONT>
<DIV dir=ltr align=left><FONT face=Arial>System.out.println(<FONT
color=#008000>"my rule");</FONT></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial>priority.setPriorityName(<SPAN
class=096121117-15092008>"A"</SPAN></FONT><FONT face=Arial>);</FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial></FONT> </DIV><FONT face=Arial>
<DIV dir=ltr align=left>end</DIV></FONT></FONT>
<DIV dir=ltr align=left><FONT face=Arial><FONT size=2><FONT color=#0000ff><FONT
face=Arial color=#0000ff size=2></FONT></FONT></FONT></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=096121117-15092008>Thanks,</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=096121117-15092008>David Warren</SPAN></FONT></DIV><FONT face=Arial
color=#0000ff size=2></FONT><FONT face=Arial color=#0000ff size=2></FONT><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> rules-users-bounces@lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] <B>On Behalf Of </B>Edson
Tirelli<BR><B>Sent:</B> Friday, September 05, 2008 2:59 PM<BR><B>To:</B> Rules
Users List<BR><B>Subject:</B> Re: [rules-users] Drools, Performance issues on
4.0.7 Vs 2.5<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV dir=ltr><BR> Start by eliminating the evals and writing your
constraints properly inside the patterns. Drools 3+ is orders of magnitude
faster than Drools 2.x, but you need to leverage its power in your rules. Please
read the manual as the version 3 was a completely rewrite of version 2. Version
4 is an improvement over 3.<BR><BR> As an example, look at this: <A
href="http://blog.athico.com/2006/11/rush-hour-and-content-based-routing.html">http://blog.athico.com/2006/11/rush-hour-and-content-based-routing.html</A><BR><BR>
[]s<BR> Edson<BR><BR>
<DIV class=gmail_quote>2008/9/5 Rout, Sushanta (ThoughtMill) <SPAN
dir=ltr><<A
href="mailto:Sushanta.Rout@ihg.com">Sushanta.Rout@ihg.com</A>></SPAN><BR>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">We
were using Drools 2.5 version earlier. Now we have switched to drools<BR><A
href="http://4.0.7." target=_blank>4.0.7.</A> But we see significant issues
with performance like drools 4.0.7<BR>is three times slower than 2.5 . Has
anybody encountered the issue?<BR><BR>Here is a sample of the rule, we have
some more similar to this.<BR>rule "test"<BR>
dialect "java"<BR> activation-group
"group1"<BR> when<BR>
$croNumberDetailsRequest :
CRONumberDetailsRequest()<BR>
$resdirectPhoneNumber : ResdirectPhoneNumber()<BR>
eval($resdirectPhoneNumber.getType().getId()
== 5
&&<BR><BR>$resdirectPhoneNumber.isValidForBrand($croNumberDetailsRequest.getBrand(<BR>))
&&<BR>
$croNumberDetailsRequest.getRegion() != null
&&<BR><BR>$resdirectPhoneNumber.isValidRegion($croNumberDetailsRequest.getRegion()<BR>)
&&<BR>
$croNumberDetailsRequest.getLocale() != null
&&<BR><BR><BR>$resdirectPhoneNumber.isValidForLocaleId($croNumberDetailsRequest.getLoc<BR>ale())
&&<BR><BR>$resdirectPhoneNumber.isValidSlot($croNumberDetailsRequest.getSlot()));<BR><BR>
then<BR>
ResultList.add($resdirectPhoneNumber);<BR>end<BR><BR>_______________________________________________<BR>rules-users
mailing list<BR><A
href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</A><BR><A
href="https://lists.jboss.org/mailman/listinfo/rules-users"
target=_blank>https://lists.jboss.org/mailman/listinfo/rules-users</A><BR></BLOCKQUOTE></DIV><BR><BR
clear=all><BR>-- <BR>Edson Tirelli<BR>JBoss Drools Core Development<BR>JBoss, a
division of Red Hat @ <A
href="http://www.jboss.com">www.jboss.com</A><BR></DIV></BODY></HTML>