Tips and Techniques for Improving Drools Performance
Here are various notes I’ve collected from developing a large ruleset in Drools in order to improve performance.
- Using the
==
operator overequals()
is recommended as this allows for hashing to mprove performance (link) - Nested accessors are much slower than direct field access, e.g.
age > $p.children[0].age
(link) - “StatelessSessions also support sequential mode, which is a special optimised mode that uses less memory and executes faster”
- Factor out code from the rule body; i.e., the rule bodies should be as small as possible (link)