[rules-users] column binding vs field binding - any performance implications?

Marcus Ilgner marcus.ilgner at gmail.com
Wed Mar 7 12:29:16 EST 2007


Hi Vlad,

On 3/7/07, Olenin, Vladimir (MOH) <Vladimir.Olenin at moh.gov.on.ca> wrote:
> Hi,
>
>
>
> I wonder if there are any performance implications of choosing column
> binding vs field binding (I'll be using bound variable in eval). Eg, in such
> case:
>
>
>
> Record($field : field)
>
> eval ( $field.equals("xxx") )
>
>
>
> vs
>
>
>
> $r: Record()
>
> eval ( $r.field.equals("xxx") )
>
>
>
>
>
> Does it start to make difference only when some significant number of
> variable get bound?
>
>
>
> Thanks,
>
>
>
> Vlad
>
>

If you're only comparing strings, you can write Record( field == "xxx"
) without any separate binding. I'm not sure about custom
implementations of Object::equals though. Maybe those have to be
called explicitly. That's an interesting question however. I'd be
great if someone could elaborate on that.
Additionally, using eval just executes the Java code in the expression
and hinders the engine to make a lot of optimizations. I'd imagine
that the difference in speed is not really measurable. The only
difference is one level less of indirection in the Java code in the
first approach. Not that much, really. If you're really in need of
that much optimization, you better try to eliminate the eval first and
then maybe take a look at other components of your application.

Greetings
Marcus



More information about the rules-users mailing list