I think perhaps even with the simple 1 pattern rule the overhead of putting the
rule on the agenda and firing the rule would make a big difference if the
test were done on the RHS, especially if there were a lot of 'something'
facts. Of course it can potentially get much worse if there are a lot of
A, B and C facts as in Ernest's example, since the number of rule firings
will be #A facts * #B facts * #C facts. If only 10 of each that would be 1000
rule firings .. not to mention  much more space/cpu consumed to store
partial matches etc.in the pattern net.

"Ernest J. Friedman-Hill" wrote:

> It is virtually always better to do all your tests on the LHSs of your
> rules. For a rule with one one CE, like this one, it doesn't matter
> much, but for a rule like
>
>       (defrule good (A ?a&:(eq ?a nothing)) (B ?b) (C ?c) => ...)
>       (defrule bad (A ?a) (B ?b) (C ?c) => (if (eq ?a nothing ) ...)
>
> the difference can be huge. Making "good" faster than "bad" is, in fact,
> the whole point of the Rete algorithm.
>
> I think Christo Andonyadis wrote:
> >
> > Which is better/faster:
> >
> > (something ?s)
> > =>
> > (if (eq ?s nothing) then
> >       (assert (somethingelse nothingatall))
> > )
> >
> > OR
> >
> > (something ?s&:(eq ?s nothing))
> > =>
> > (assert (somethingelse nothingatall))
> > ---------------------------------------------------------------------
> > To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
> > in the BODY of a message to [EMAIL PROTECTED], NOT to the
> > list. List problems? Notify [EMAIL PROTECTED]
> > ---------------------------------------------------------------------
> >
> >
>
> ---------------------------------------------------------
> Ernest Friedman-Hill
> Distributed Systems Research        Phone: (925) 294-2154
> Sandia National Labs                FAX:   (925) 294-2234
> Org. 8920, MS 9214                  [EMAIL PROTECTED]
> PO Box 969                  http://herzberg.ca.sandia.gov
> Livermore, CA 94550
>
> ---------------------------------------------------------------------
> To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
> in the BODY of a message to [EMAIL PROTECTED], NOT to the
> list. List problems? Notify [EMAIL PROTECTED]
> ---------------------------------------------------------------------
begin:vcard 
n:Orchard;Bob
tel;fax:613-952-7151
tel;work:613-993-8557
x-mozilla-html:FALSE
adr:;;;;;;
version:2.1
email;internet:[EMAIL PROTECTED]
x-mozilla-cpt:;0
fn:Bob Orchard
end:vcard

Reply via email to