[rules-users] field binding performance implications
Edson Tirelli
tirelli at post.com
Wed Mar 21 16:46:41 EDT 2007
Vlad,
Didn't tested myself, but I don't see a reason for performance impacts
adding unneeded declarations, except for consuming a bit more of memory,
but I would say would be negligible in the numbers you provided.
Although, may I suggest that you generate Descriptors instead of DRL?
This will give you gains in parsing time (as there will not be parsing),
besides being easier than using string templates IMO. Also, if you want
to store a "text" based version of your rules, you can simply use a
dumper to dump wherever syntax you prefer.
[]s
Edson
Olenin, Vladimir (MOH) wrote:
> Hi,
>
> We need to generate drl file from a template. Since the format of the
> rules parameters doesn’t fall very well within decision table concept
> (the parameters are not ‘homogeneous’, so each row in the input excel
> table can mean different things), we decided to define the rules by
> automatically generating drl files from a set of templates. To cover
> more cases with a single template we’d need to bind every field of
> column by default, even if the binding would not be used.
>
> For example (Freemarker syntax is used in the template below):
>
> Rule ${ruleId}
>
> When
>
> Record ( $account : account ${operation} ${value} )
>
> ….
>
> Then
>
> …..
>
> End
>
> In the example above, ‘operation’, ‘value’ and ‘ruleId’ are objects in
> the data model that we merge with the template. One case of the rule
> would be when both ‘operation’ and ‘value’ are empty strings. This
> will result in this LHS: Record ( $account : account ). Another case
> might be when ‘operation’ is ‘==’ string and ‘value’ is ‘1’: Record (
> $account : account == 1 ).
>
> The above is a simplified template to demonstrate the point. The real
> business data model for facts (Record object) would have around 10
> fields and we can have ~ 5 to 10 columns per rule. I wonder what kind
> of performance implications does field binding bring? Are there any or
> this is being optimized / filtered out by some preprocessor?
>
> In other words, is there significant difference in performance for the
> following LHS expressions:
>
> 1) Record ( $account : account, $name : name == ‘xxx’, $balance :
> balance > 100, ….)
>
> Vs
>
> 2) Record (name == ‘xxx’, balance > 100, ….)
>
> Providing the functionality of both of these LHS expressions is the
> same and field bindings in LHS #1 are never used throughout the rule.
>
> Thanks,
>
> Vlad
>
>------------------------------------------------------------------------
>
>_______________________________________________
>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 3124-6000
Mobile: +55 11 9218-4151
JBoss, a division of Red Hat @ www.jboss.com
More information about the rules-users
mailing list