Hi Edson,<br><br>Thanks for your reply.<br><br>WRT your reply below (highlighted):<br>In our environment, we only have one class and several instances of that class.<br><br>We currently do not use the &quot;==&quot; constraint and we do a equals() on the name string. However, I am going to use &quot;==&quot; since there will be only one object with a particular name.
<br><br>Also, can you define what the number for &quot;huge&quot; is? How many buckets get defined initially for the hashing. Can I modify the initial size of this collection so that I will not have clashes. ( I happen to know exactly how many objects will be thrown into the engine)
<br><br>Is this set through configuration or would I have to recompile code to do this?<br><br>Thanks,<br>Prem<br><br><div><span class="gmail_quote">On 3/23/07, <b class="gmail_sendername">Edson Tirelli</b> &lt;<a href="mailto:tirelli@post.com">
tirelli@post.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>&nbsp;&nbsp; Stephen,<br><br>&nbsp;&nbsp; <span style="font-weight: bold;">
As long as you use an &quot;==&quot; constraint as your example shows</span>, the<br>first alternative will be more performatic. This is because drools<br>indexes facts based on your constraints. So, your first case will<br>
require a single &quot;==&quot; comparison to find user name &quot;A&quot; and a single<br>comparison to find user name &quot;B&quot;. <span style="font-weight: bold; background-color: rgb(255, 255, 102);">Of course, if you have huge amound of
</span><br style="font-weight: bold; background-color: rgb(255, 255, 102);"><span style="font-weight: bold; background-color: rgb(255, 255, 102);">objects where hashcode for name start to clash, you may have more than</span>
<br style="font-weight: bold; background-color: rgb(255, 255, 102);"><span style="font-weight: bold; background-color: rgb(255, 255, 102);">one comparison,</span> but the effect is negligible when compared to all other<br>
costs of having that many facts.<br><br>&nbsp;&nbsp; Second alternative works and will also hash object types, but it will<br>create a lot more infrastructure classes and Rete Nodes to deal with<br>your 500 different classes. So it is a worst alternative for the
<br>proposed scenario.<br><br>&nbsp;&nbsp; []s<br>&nbsp;&nbsp; Edson<br><br><br>Premkumar Stephen wrote:<br><br>&gt; Hi,<br>&gt;<br>&gt; Consider that I have 500 instances of interface userI. Now, there are<br>&gt; 3000 rules currently written based on a combination of these instances.
<br>&gt;<br>&gt; if {<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$a : userI (name = &quot;A&quot;)<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$b : userI (name = &quot;B&quot;)<br>&gt; }<br>&gt; then<br>&gt; {<br>&gt;&nbsp;&nbsp;//do some actions<br>&gt; }<br>&gt;<br>&gt; How many tests are needed for a match in the RETE network for this rule?
<br>&gt;<br>&gt; If I created 500 classes, one for each object, such as UserA<br>&gt; implements userI and so on... my rule will look like:<br>&gt;<br>&gt; if {<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$a : UserA()<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$b : UserB()<br>&gt; }
<br>&gt; then<br>&gt; {<br>&gt;&nbsp;&nbsp;//do some actions<br>&gt; }<br>&gt;<br>&gt; Will this lead to better performance since there will only be one such<br>&gt; instance of this object?<br>&gt;<br>&gt; As for class-loading concerns, will there be a parsing/memory penalty
<br>&gt; to be paid for having 500 classes now instead of one?<br>&gt;<br>&gt; Thanks!<br>&gt;<br>&gt;------------------------------------------------------------------------<br>&gt;<br>&gt;_______________________________________________
<br>&gt;rules-users mailing list<br>&gt;<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>&gt;<a href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users
</a><br>&gt;<br>&gt;<br><br><br>--<br> Edson Tirelli<br> Software Engineer - JBoss Rules Core Developer<br> Office: +55 11 3124-6000<br> Mobile: +55 11 9218-4151<br> JBoss, a division of Red Hat @ <a href="http://www.jboss.com">
www.jboss.com</a><br><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">
https://lists.jboss.org/mailman/listinfo/rules-users</a><br></blockquote></div><br><br clear="all"><br>-- <br>Regards,<br>Prem