ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button
Article:
  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


Obj
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.


1 to 1 of 1
  1. Performance Considerations Also
    2005-08-08 14:21:25  paul_browne [View]

1 to 1 of 1