Drools 5.3.0 FINAL.<br><br>This experiment was inspired by code posted with the insinuation that MVEL would "optimize" condition evaluation. - Consider this rule:<br><br>rule "Term - java"<br>dialect "java"<br>
when<br> $ea : EasyApp( Test.valueInList( $ea.getProductCode(), "CAR" )==true<br> && age < 0 )<br>then end<br><br>You'd expect that Test.valueInList() is called once per inserted EasyApp fact, and this can be verified easily. - Now the same rule, with MVEL's syntactic sugar:<br>
<br>rule "Term - mvel"<br>dialect "mvel"<br>when<br> $ea : EasyApp( Test.valueInList( productCode, "CAR" )==true<br> && age < 0 )<br>then end<br><br><i><b>Now Test.valueInList() is called twice for each inserted fact.</b></i><br>
<br>Cheers<br>Wolfgang<br><br><br>