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 "==" constraint and we do a equals() on the name string. However, I am going to use "==" since there will be only one object with a particular name.
<br><br>Also, can you define what the number for "huge" 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> <<a href="mailto:tirelli@post.com">
tirelli@post.com</a>> 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> Stephen,<br><br> <span style="font-weight: bold;">
As long as you use an "==" 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 "==" comparison to find user name "A" and a single<br>comparison to find user name "B". <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> 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> []s<br> Edson<br><br><br>Premkumar Stephen wrote:<br><br>> Hi,<br>><br>> Consider that I have 500 instances of interface userI. Now, there are<br>> 3000 rules currently written based on a combination of these instances.
<br>><br>> if {<br>> $a : userI (name = "A")<br>> $b : userI (name = "B")<br>> }<br>> then<br>> {<br>> //do some actions<br>> }<br>><br>> How many tests are needed for a match in the RETE network for this rule?
<br>><br>> If I created 500 classes, one for each object, such as UserA<br>> implements userI and so on... my rule will look like:<br>><br>> if {<br>> $a : UserA()<br>> $b : UserB()<br>> }
<br>> then<br>> {<br>> //do some actions<br>> }<br>><br>> Will this lead to better performance since there will only be one such<br>> instance of this object?<br>><br>> As for class-loading concerns, will there be a parsing/memory penalty
<br>> to be paid for having 500 classes now instead of one?<br>><br>> Thanks!<br>><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>><br>><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