[rules-users] Efficiency Question

Edson Tirelli tirelli at post.com
Wed Jul 4 09:00:00 EDT 2007


   Simon,

   Looking at your rule by itself, without knowing value distribution, I
think your rule is as efficient as it can be. You are adding the more
restrictive, indexed and common to multiple rules patterns first, so they
will be also shared among rules, indexed and hashed.

   []s
   Edson

2007/7/4, Simon French <french.simon at gmail.com>:
>
> Hi.
> I'm wondering if somebody could tell me if what I'm doing is efficient or
> not.
>
> Having written a number of rules we found that we were duplicating a
> number of constants, and if any of the "constants" (we later found out they
> are more like variants !!) it meant changing them in a number of places.
>
> What we came up with was to use a spreadsheet with three columns, variable
> name, a string value and a numeric value. We then used a little VB to
> produce an XML document, and via JAXB load the XML in as Java classes and
> assert the data into working memory.
>
> So we have a Class something like :-
>
> public class ConstantValueType {
>
>     protected String varName;
>     protected int intVal;
>     protected String stringVal;
>
>  ...........
> }
>
> Then within our rules we doing
>
> rule "Exclusions 1"
> salience 500
> when
>     ConstantValueType(varName == "MaxProposerAge",$maxProposerAge :
> intVal  )
>     $res : ResultData(schemeCode == "TE")
>     $pr : Proposer($age : age > $maxProposerAge )
> then
>     System.out.println("**** Not flexing because proposer age >=
> "+($maxProposerAge+1));
>     retract($res);
> end
>
> What I'm wondering is because I'm  doing a ?join?     pr : Proposer($age :
> age > $maxProposerAge ) presumably this is similar to an eval and as such
> the rules engine is having to evaluate this each time rather than having the
> information ready to hand each time the rule is evaluated?
>
> If this is inefficient is there another way of achieving this? We're
> currently working with 3.0.6
>
> As it stands the rules engine is flying, but it would be nice to know if
> what I'm doing could be done better
>
> Thanks in advance
>
> Simon
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>


-- 
  Edson Tirelli
  Software Engineer - JBoss Rules Core Developer
  Office: +55 11 3529-6000
  Mobile: +55 11 9287-5646
  JBoss, a division of Red Hat @ www.jboss.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20070704/ad42df55/attachment.html 


More information about the rules-users mailing list