Dear user group:

        I have a queston about the performance of drools3.0.
     My only one rule is:

     rule "alarmdefine" 
     no-loop true 
     when 
     #conditions 
     alarm(reason:alarmreason, level:alarmlevel) 
     alarmdefine(alarmreason==reason, alarmlevel!=level) 
     then 
     #actions 
     alarm.setCounter();? 
     end 

     My eviroment:  eclipse3.2M5, jdk1.4.2-03
        Testcode is :

                   for(int i=1; i<1000; i++)
            {
                alarm malarm = new alarm();
                malarm.setAlarmreason(i);
                malarm.setAlarmlevel(1);
                malarm.setObjtype(1);
                malarm.setAlarmtype(1);
              workingMemory.assertObject( malarm );
     workingMemory.fireAllRules();
            }

     when alarmdefine exist 50000 record,  execute time is 20s 
     when alarmdefine exist 5000 recode,  execute time is 2s 

     Then I have done the same test with JESS, the rule is:

     (defrule alarm-cleared-all 
     (alarm (alarmreason ?a) (alarmlevel ?x) ) 
     (alarmdef (alarmreason ?a) (alarmlevel ?y&:(<> ?y ?x))) 
     => 
     (call alarm setCounter) 
     ) 

     when alarmdefine exist 50000 record, execute time is only 0.2s 
     
     Great difference!  Why?  What can I do?
     
     Thanks
     Wangwei

Reply via email to