1
votes

I have many rule constraints that can be logically grouped together by "or". For example: 3 rules "r1", "r2" and "r3". I can construct a single LHS as:

(r1 || r2 || r3)

Or I can make each of them a separate rule. I have no critical functional requirement for doing it either way since I can detect their grouping independently outside of Drools.

I wonder if one way is more advantageous than the other from runtime execution perspective (performance, memory, etc.).

1

1 Answers

0
votes

A disjunction at pattern level is handled very much like two different rules, so there's not much gained or lost either way.

But from a maintenance and development point of view, two separate rules require two copies of the right hand side, so using a disjunction in a single rule appears to be preferable.

Establishing binding variables used to be a little tricky but I think that recent versions (6.x) of Drools handle that satisfactorily.

Note that disjunctions at constraint level should definitely not be split into separate rules.