I think Gang Liu wrote:
> Thank you for your suggestion!
>
> I profiled my Jess application and figured out the time goes to line 8.
>
> 1. Funcall f = new Funcall("definstance", rete);
...
> 8. f.execute(rete.getGlobalContext());
>
So the compute time is going into pattern matching (recall that
pattern matching occurs when a fact or definstance is asserted,
modified, or retracted.) Therefore, to optimize this application,
you'll need to look at the left-hand-sides of your rules.
Read chapter 8 of the manual, and look at every rule with a critical
eye. Use the (matches) and (view) command to see the partial matches
that the rules create.
> The rules are similar to the following:
> (defrule trap-mapping
> (newtrap (OBJECT ?trap)(number ?trapno ))
> (event (OBJECT ?event)(number ~?trapno ))
> =>
> (set ?event number ?trapno )
> )
>
>
> Any ideas? How to optimize these?
> I still observed performance was going down little by little when I gave
> input to this application constantly.
Chances are you've got a rule that is forming a nuber of partial
matches proportional to the square or cube (or a higher power) of the
number of some particular kind of facts.
>
> >From performance point of view, what are the differences among 4), 5) and 6)
> applications? ( 4), 5) and 6) are defined in Jess doc 1.9)
This is a micro-optimization question; it really doesn't matter
much. One micro-optimization that I would reccomend, if only because
it would simplify your code a lot: the Rete class has definstance()
and defclass() methods you can use instead of building a Funcall; the
Funcall will just be a wraper for these.
>
> thanks
>
> Gang
>
> >From: [EMAIL PROTECTED]
> >Reply-To: [EMAIL PROTECTED]
> >To: [EMAIL PROTECTED]
> >Subject: Re: JESS: How to increase my Jess application's performance?
> >Date: Thu, 16 May 2002 12:33:10 -0700 (PDT)
> >
> >The first step to optimizing any computer program, of any kind, is to
> >profile it: find out, using whatever tools are available to you, where
> >the time is going. Until you've done this, there's not much point in
> >talking about what to do next.
> >
> >I think Gang Liu wrote:
> > > hi, Sir/Madam
> > >
> > > I wrote a Jess application. I want to improve its performance. I am
> >eager to
> > > get your help. Thanks!
> > >
> > > I chose an architecture of 6) application:
> > > Mostly Java code, which loads Jess language scripts at runtime.
> > >
> > > Actually, I followed the pumps sample in
> >Jess\Jess60\jess\examples\pumps. I
> > > refered MainInJava.java to implementing my Jess application.
> > >
> > > I designed 3 java classes and 1 rule. These 3 classess were similar to
> > > MainInjava.java, Tank.java and Pump.java in the pumps sample. That rule
> >was
> > > the simplified version of pumps-fromjava.clp.
> > >
> > > If I want to increase performance, what will I do? Change architecture?
> > > Optimize my java code or rule? Any ideas of how to change or optimize?
> > >
> > > appreciate it!
> > >
> > > thanks
> > >
> > > Gang
> > >
> > >
> > >
> >
> >
> >---------------------------------------------------------
> >Ernest Friedman-Hill
> >Distributed Systems Research Phone: (925) 294-2154
> >Sandia National Labs FAX: (925) 294-2234
> >Org. 8920, MS 9012 [EMAIL PROTECTED]
> >PO Box 969 http://herzberg.ca.sandia.gov
> >Livermore, CA 94550
> >
> >--------------------------------------------------------------------
> >To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
> >in the BODY of a message to [EMAIL PROTECTED], NOT to the list
> >(use your own address!) List problems? Notify [EMAIL PROTECTED]
> >--------------------------------------------------------------------
> >
>
>
> _________________________________________________________________
> Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.
>
>
> --------------------------------------------------------------------
> To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
> in the BODY of a message to [EMAIL PROTECTED], NOT to the list
> (use your own address!) List problems? Notify [EMAIL PROTECTED]
> --------------------------------------------------------------------
>
---------------------------------------------------------
Ernest Friedman-Hill
Distributed Systems Research Phone: (925) 294-2154
Sandia National Labs FAX: (925) 294-2234
Org. 8920, MS 9012 [EMAIL PROTECTED]
PO Box 969 http://herzberg.ca.sandia.gov
Livermore, CA 94550
--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the list
(use your own address!) List problems? Notify [EMAIL PROTECTED]
--------------------------------------------------------------------