[rules-users] question on rule efficiency

Barry Kaplan groups1 at memelet.com
Thu Jun 5 11:36:50 EDT 2008


When the value of a property is compared across two instances, is it better
to create variables for the properties, or is using the object.property for
the comparison equivalent?

Here's an example: I need to match based on the strikePrice property. Is
either version better than the other?


version 1)

   putContract  : OptionInstrument(
                                   optionType == OptionType.PUT) 
   callContract : OptionInstrument(
                                   optionType == OptionType.CALL,
                                   strikePrice > putContract.strikePrice)  
// compare using navigation

version 2)
   putContract  : OptionInstrument(
                                   optionType == OptionType.PUT,
                                   putStrikePrice : strikePrice)              
// delcare the variable
   callContract : OptionInstrument(
                                   optionType == OptionType.CALL,
                                   strikePrice > putStrikePrice)             
// compare using variable

-- 
View this message in context: http://www.nabble.com/question-on-rule-efficiency-tp17672843p17672843.html
Sent from the drools - user mailing list archive at Nabble.com.




More information about the rules-users mailing list