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))&&isCurrencyEquals($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))&&isCurrencyEquals($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