Fwd: [rules-users] Predicate expression effect on performance

Yuri de Wit ydewit at gmail.com
Fri Jul 20 12:52:28 EDT 2007


(well, I'll keep trying)

---------- Forwarded message ----------
From: Yuri de Wit <ydewit at gmail.com>
Date: Jul 20, 2007 1:17 AM
Subject: Re: [rules-users] Predicate expression effect on performance
To: Rules Users List <rules-users at lists.jboss.org>


(sorry, the OR was not part of the sample rule: I was just considering
the same rule written in two different ways)

I am seeing a considerable performance problem with my rules and I am
trying to narrow down why. I have a small number or rules but hundreds
of thousands of facts. At first the assertion goes very fast but it
quickly degrades as more facts are asserted.

I already reordered the predicates (I have between 8-12 predicates in
most rules and reordered them more restrictive first) and saw some
improvements, but not nearly enough.

Then thought about to what extent predicate expressions where hitting
me. Per what you say that cant be the reason.

If Check is updated (as you mentioned) would that be equivalent to
reasserting it into memory? I keep a status as a property of Check
that get updated somewhat often.

thanks,

On 7/20/07, Michael Neale <michael.neale at gmail.com> wrote:
> In a sense, yes - but its the result of the comparison that is "cached"
> really.
>
> In the case you described, it is subrule generation. So either side of the
> "or" is like a separate rule.
> In version 3, the result of isSameAmount (ie if it was true or false) is
> "cached".
>
> Things will only be re-checked if the "Check" fact changes (and the engine
> knows about the change).
>
> Note that this checking happens as you are asserting objects, not when you
> "fireAllRules" necessarily.
>
>
> On 7/20/07, Yuri de Wit <ydewit at gmail.com> wrote:
> >
> > What is the extent of the performance impact caused by using predicate
> > expressions?
> >
> > Check( amount == $amount )
> > or
> > Check( $amt : amount -> (isSameAmount($amt, $amount) )
> >
> > My understanding is that once asserted the amount property will be
> > "cached" in the shadow fact, is the result of isSameAmount(...) also
> > cached?
> >
> > thanks,
> >
> > -- yuri
> > _______________________________________________
> > rules-users mailing list
> > rules-users at lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/rules-users
> >
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>



More information about the rules-users mailing list