<br>&nbsp;&nbsp; Barry, <br><br>&nbsp;&nbsp; For your example, there would be no difference really, because Drools detects that &quot;putContract&quot; is a pattern binding and that &quot;strikePrice&quot; is a field of &quot;putContract&quot;. So, in your version number, it will automatically generate a binding for the field and behind the scenes, it will behave exactly like version 2. <br>
&nbsp;&nbsp; Although, it is IMPORTANT to note that, if &quot;putContract&quot; was not a pattern binding (for instance, it could be a field binding itself) or if you had used deeper nested accessors, like &quot;person.address.street&quot;, drools would not be able to optimize and it would be more expensive to execute.<br>
&nbsp; <br>&nbsp;&nbsp; []s<br>&nbsp;&nbsp; Edson<br><br><div class="gmail_quote">2008/6/5 Barry Kaplan &lt;<a href="mailto:groups1@memelet.com">groups1@memelet.com</a>&gt;:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
When the value of a property is compared across two instances, is it better<br>
to create variables for the properties, or is using the object.property for<br>
the comparison equivalent?<br>
<br>
Here&#39;s an example: I need to match based on the strikePrice property. Is<br>
either version better than the other?<br>
<br>
<br>
version 1)<br>
<br>
 &nbsp; putContract &nbsp;: OptionInstrument(<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; optionType == OptionType.PUT)<br>
 &nbsp; callContract : OptionInstrument(<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; optionType == OptionType.CALL,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; strikePrice &gt; putContract.strikePrice)<br>
// compare using navigation<br>
<br>
version 2)<br>
 &nbsp; putContract &nbsp;: OptionInstrument(<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; optionType == OptionType.PUT,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; putStrikePrice : strikePrice)<br>
// delcare the variable<br>
 &nbsp; callContract : OptionInstrument(<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; optionType == OptionType.CALL,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; strikePrice &gt; putStrikePrice)<br>
// compare using variable<br>
<font color="#888888"><br>
--<br>
View this message in context: <a href="http://www.nabble.com/question-on-rule-efficiency-tp17672843p17672843.html" target="_blank">http://www.nabble.com/question-on-rule-efficiency-tp17672843p17672843.html</a><br>
Sent from the drools - user mailing list archive at Nabble.com.<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>
</font></blockquote></div><br><br clear="all"><br>-- <br> Edson Tirelli<br> JBoss Drools Core Development<br> Office: +55 11 3529-6000<br> Mobile: +55 11 9287-5646<br> JBoss, a division of Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a>