It&#39;s difficult to suggest an optimized form for your rules 1-infinity, since we do not know what you want to achieve.<br><br>The crude duplication of rules where only the constant to be matched with Product.id varies can, most likely, be avoided.<br>
<br>-W<br><br><br><br><div class="gmail_quote">On Sun, Jul 19, 2009 at 3:15 PM, nesta <span dir="ltr">&lt;<a href="mailto:nesta.fdb@163.com">nesta.fdb@163.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
Hi,<br>
<br>
I am a newbie in drools. There are a lot of simple rules in a scenario.<br>
For example<br>
rule 1<br>
    when<br>
        Product( id ==1, usage == 1)<br>
        $decision : Decision()<br>
    then<br>
         $decision.setValue(1);<br>
end<br>
<br>
rule 2<br>
when Product( id ==2, usage == 1)<br>
 $decision : Decision()<br>
rule 3<br>
when Product( id ==3, usage == 1)<br>
 $decision : Decision()<br>
rule 4<br>
when Product( id ==4, usage == 1)<br>
 $decision : Decision()<br>
rule 5<br>
when Product( id ==5, usage == 1)<br>
 $decision : Decision()<br>
......<br>
<br>
I have a Product fact whose id = 5 and usage = 1, in my first thinking, only<br>
rule 5 is matched, there should be not much more different between 1 rule<br>
and a lot of rules in runtime.<br>
<br>
But the result shows that they are different. More rules will cost more<br>
time. If there are 1 thousand rules, some Node and Sink will execute 1<br>
thousand times.<br>
<br>
My question is how to optimize this scenario?<br>
<font color="#888888">--<br>
View this message in context: <a href="http://www.nabble.com/optimization-on-a-lot-of-simple-rules-tp24556724p24556724.html" target="_blank">http://www.nabble.com/optimization-on-a-lot-of-simple-rules-tp24556724p24556724.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>