[rules-dev] Accumulate are slow issues + how to benchmark accumulate yourself

Geoffrey De Smet ge0ffrey.spam at gmail.com
Sun Aug 9 05:01:17 EDT 2009


I've talked with edson and later mark a bit on IRC and they identified 3 
issues which I created in JIRA:

https://jira.jboss.org/jira/browse/JBRULES-2238
   Accumulate should be implemented with left-input incremental so they 
don't start from scratch on every left-input retraction/assertion
https://jira.jboss.org/jira/browse/JBRULES-2239
   Batching accumulate to avoid wasteful re-propagations
https://jira.jboss.org/jira/browse/JBRULES-2240
   True modify


You can easily benchmark any before and after your changes with this 
"run configuration":

- Project: drools-solver-examples
- Run configuration name: ExaminationBenchmarkApp short
- Main class: 
org.drools.solver.examples.itc2007.examination.app.ExaminationBenchmarkApp
- VM parameters: -Xms256m -Xmx512m -server
- Program parameters: short
- Working directory: .../drools/drools-solver/drools-solver-examples

If you run this, it will do a 100 steps of the examination problem (on 
my pc this takes 71s). The last line of output will be like this:

2009-08-08 10:10:55,499 [main] INFO  Solved at step index (99) with time 
spend (71524) for best score (0hard/-7545soft).

The "time spend (71524)" tells you how many milliseconds it took.
The "best score (0hard/-7545soft)" should never change in any changes 
you make.


You'll want to make changes in the examinationScoreRules.drl file:
drools/drools-solver/drools-solver-examples/src/main/resources/org/drools/solver/examples/itc2007/examination/solver/examinationScoreRules.drl

There are 3 rules of interest in there that use accumulate:

rule "roomCapacityTooSmall" // TODO improve performance, as it takes 50% 
of the performance

rule "hardConstraintsBroken"

rule "softConstraintsBroken"


PS: Note that drools-solver on trunk is fixed on drools-core 5.0.1 in 
the drools-solver pom.xml (you can easily change this).

-- 
With kind regards,
Geoffrey De Smet



More information about the rules-dev mailing list