Node indexing

As the facts propagate through the Rete network, another optimization technique is to index fact values. We can then evaluate each test more quickly.

The AlphaNode indexing

When a fact meets constraints specified by a node, it is propagated to all its descending child nodes. This usually means iterating over all child nodes and propagating the fact. This takes some time, especially if there are many child nodes. Luckily, we can index some AlphaNode node. The AlphaNode node with the equals constraints (literal constraints). By default, Drools creates an index (a hash table) if we are testing a property for more than three different values. The object is propagated only to nodes, where it makes sense (test will succeed). This means that ...

Get Drools JBoss Rules 5.X Developer's Guide now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.