Women in Technology

Hear us Roar

  Give Your Business Logic a Framework with Drools
Subject:   Performance Considerations Also
Date:   2005-08-08 09:59:45
From:   johnwatts1
I think the extraction of rules solely for the purpose of putting them into an XML structure is of dubious value. I took a quick swipe at comparing a standard if/then/else Java object model validation check and compared it with Drools. This gives me the idea that performance may be the second advantage to rules engines over traditional if/then statements in Java.

Below were the results in milliseconds. The first set (iterations on a small object base) total time includes set up of the drl file for drools. The second set shows where a real benefit can be gained by optimizing a large object validation with a rules engine.

Iter Java Drools
1 10 10
10 0 0
100 10 0
1000 10 0
10000 40 0
100000 161 0
1000000 1572 40
Total 1803 1582

1 111 20
10 871 10
100 7771 60
1000 78344 261
10000 761312 23655

At 100000 objects, I ran into out of memory errors. The number of iterations test showed a reasonable number for Java objects, however if you anticipate having to validate a large number of objects against a set of rules, the rules engine may buy you a significant performance gain over standard O-O practices.

I haven't tried doing this with a very large rule set, but that would be another angle.

Full Threads Newest First

Showing messages 1 through 1 of 1.

  • Performance Considerations Also
    2005-08-08 14:21:25  paul_browne [View]

    It's interesting to see the performance results you got - for most substantial applications , Rules Engines should run faster the equivalent Java Code. This is not only due to the Rete optimisation , but also the business logic doesn't get scattered / repeated / run more times than necessary (esp in applications with many changes to their logic over time).

    Don't let the XML Format fool you - the examples could equally have been written in Java (manipulating the Drools API) or Excel. The important thing is that you state what you know to be true rather than exactly how you do it. I'm a Java/J2EE programmer as well , and I'm suggestng Drools as a way to make things easier , not just introduce another (XML) file format.