[rules-users] Performance consideration in rule writing

Zhuo Li milanello1998 at gmail.com
Mon Dec 26 03:51:24 EST 2011


Hi, team,

 

I have some quick questions here regarding performance best practices of
rule writing. See below two pieces of rules:

 

Rule "1"

         Salience 100

         No-loop true

         When $txn : data(sourceid ==
5&&txnjustify=="995"&&eval(creditOption($txn)==1)&&eval(isGCSwitch($txn))&&i
sCurrencyEquals($txn)==0&&compareToPostThreshold($txn)==2);

         Then

                   .

         End

 

Rule "2"

         Salience 100

         No-loop true

         When $txn : data(sourceid ==
5&&txnjustify=="995"&&eval(creditOption($txn)==1)&&eval(isGCSwitch($txn))&&i
sCurrencyEquals($txn)==0&&compareToPostThreshold($txn)==1);

         Then

                  .

         End

 

Questions:

1.       Will I gain better performance if I put the rule differentiator
condition "compareToPostThreshold($txn)==2" at the beginning of both rule 1
and 2? 

2.       I saw salaboy's video claiming that to avoid using eval() in the
rule. Do we have any alternative way to do that from a performance
consideration or I'd better collect/ prepare all the data before I send them
into the session?

3.       What's you guys' naming convention for rule's salience?

 

PS: my Drools version is 5.2.0.

 

Best regards

Abe

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20111226/74d2d1a6/attachment.html 


More information about the rules-users mailing list