when I looked at the code the person posted earlier, it looked wrong.
> > 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();
> > }
if that is correct, the program is only asserting alarm class and not the
other one. I'll take a look at the zip file in a little bit.
peter
On 4/26/06, Michael Neale <[EMAIL PROTECTED]> wrote:
>
> Peter, attached is the collection of the rules, and the beans to
> reproduce.
> You may be able to shed some light on the jess one.
>
> Michael.
>
>
> On 4/27/06, Peter Lin <[EMAIL PROTECTED]> wrote:
> >
> > did the user post the entire source for his test in drools3 and JESS?
> >
> > peter
> >
> >
> > On 4/26/06, Michael Neale <[EMAIL PROTECTED]> wrote:
> > >
> > > yeah in my noodling I got < 5 seconds, but its was just a guess. I
> > would
> > > like to know what Jess does.
> > > I gather there are 50 million combinations to test, so 0.2 seconds
> > seems a
> > > little unrealistic... but no hard facts.
> > >
> > > On 4/27/06, Peter Lin < [EMAIL PROTECTED]> wrote:
> > > >
> > > > looking at some recent results I got, 20 seconds seems a bit off.
> > > >
> > > >
> > http://woolfel.blogspot.com/2006/04/comparing-sumatra-and-drools-3.html
> > > >
> > > > when I ran a test with 20 rules with 2 conditional Elements and 5
> > shared
> > > > nodes. it was 1.1 seconds for 50K objects.
> > > >
> > > > the sample rule is probably matching fully for all 50K objects , so
> > that
> > > > could explain the 20 seconds. it would be useful to get the
> > benchmark,
> > > > classes and jess sample.
> > > >
> > > > peter
> > > >
> > > >
> > > >
> > > > On 4/26/06, Mark Proctor <[EMAIL PROTECTED]> wrote:
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > ---------- Forwarded message ----------
> > > > > From: "Michael Neale" <[EMAIL PROTECTED] >
> > > > > To: [email protected]
> > > > > Date: Wed, 26 Apr 2006 19:53:24 +1000
> > > > > Subject: Re: [drools-user] reply: [drools-user] Question: about
> > > > drools3.0performnce
> > > > > and the code to invoke? I assume you have 50000 instances of
> > > AlarmDefine
> > > > > in
> > > > > wm? (that is implied).
> > > > >
> > > > >
> > > > > On 4/26/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]>
> > wrote:
> > > > > >
> > > > > >
> > > > > > Thanks, the whole rule file:
> > > > > >
> > > > > > package com.datangmobile.rules
> > > > > >
> > > > > > import com.datangmobile.rules.alarmdefine;
> > > > > > import com.datangmobile.rules.alarm;
> > > > > >
> > > > > > rule "alarmdefine"
> > > > > > no-loop true
> > > > > > when
> > > > > > #conditions
> > > > > > alarm(reason:alarmreason, level:alarmlevel)
> > > > > > alarmdefine(alarmreason==reason,
> > alarmlevel!=level)
> > > > > > then
> > > > > > #actions
> > > > > > alarm.setCounter();
> > > > > > end
> > > > > >
> > > > > > alarmdefine object:
> > > > > > package com.datangmobile.rules;
> > > > > >
> > > > > > public class alarmdefine {
> > > > > >
> > > > > > private int alarmreason;
> > > > > > private int alarmlevel;
> > > > > > private int objtype;
> > > > > > private int alarmtype;
> > > > > >
> > > > > > public int getAlarmlevel() {
> > > > > > return alarmlevel;
> > > > > > }
> > > > > > public void setAlarmlevel(int alarmlevel) {
> > > > > > this.alarmlevel = alarmlevel;
> > > > > > }
> > > > > > public int getAlarmreason() {
> > > > > > return alarmreason;
> > > > > > }
> > > > > > public void setAlarmreason(int alarmreason) {
> > > > > > this.alarmreason = alarmreason;
> > > > > > }
> > > > > > public int getAlarmtype() {
> > > > > > return alarmtype;
> > > > > > }
> > > > > > public void setAlarmtype(int alarmtype) {
> > > > > > this.alarmtype = alarmtype;
> > > > > > }
> > > > > > public int getObjtype() {
> > > > > > return objtype;
> > > > > > }
> > > > > > public void setObjtype(int objtype) {
> > > > > > this.objtype = objtype;
> > > > > > }
> > > > > > }
> > > > > >
> > > > > > alarm object:
> > > > > > package com.datangmobile.rules;
> > > > > >
> > > > > > public class alarm {
> > > > > >
> > > > > > private int alarmreason;
> > > > > > private int alarmlevel;
> > > > > > private int objtype;
> > > > > > private int alarmtype;
> > > > > > private String dn;
> > > > > >
> > > > > > static private int counter = 0;
> > > > > >
> > > > > > public int getAlarmlevel() {
> > > > > > return alarmlevel;
> > > > > > }
> > > > > > public void setAlarmlevel(int alarmlevel) {
> > > > > > this.alarmlevel = alarmlevel;
> > > > > > }
> > > > > > public int getAlarmreason() {
> > > > > > return alarmreason;
> > > > > > }
> > > > > > public void setAlarmreason(int alarmreason) {
> > > > > > this.alarmreason = alarmreason;
> > > > > > }
> > > > > > public int getAlarmtype() {
> > > > > > return alarmtype;
> > > > > > }
> > > > > > public void setAlarmtype(int alarmtype) {
> > > > > > this.alarmtype = alarmtype;
> > > > > > }
> > > > > > public String getDn() {
> > > > > > return dn;
> > > > > > }
> > > > > > public void setDn(String dn) {
> > > > > > this.dn = dn;
> > > > > > }
> > > > > > public int getObjtype() {
> > > > > > return objtype;
> > > > > > }
> > > > > > public void setObjtype(int objtype) {
> > > > > > this.objtype = objtype;
> > > > > > }
> > > > > >
> > > > > > static public void setCounter(){
> > > > > >
> > > > > > counter++;
> > > > > > }
> > > > > >
> > > > > > static public int getCounter(){
> > > > > > return counter;
> > > > > > }
> > > > > > }
> > > > > >
> > > > > >
> > > > > >
> > > > > > can you provide your objects that you are using, and the whole
> > rule
> > > > > file?
> > > > > >
> > > > > > On 4/26/06, [EMAIL PROTECTED] <[EMAIL PROTECTED] >
> > > wrote:
> > > > > > >
> > > > > > > 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
> > > > > > >
> > > > > >
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>