I think Gang Liu wrote:

> It is expensive to retract that fact and create a new one if that
> fact holds many entities.

I think you're assuming that calling "new Fact" and a bunch of
setSlotValue()'s is "expensive". That may well be, but for a
nontrivial rule base and a decent-sized working memory, creating the
Fact object itself is a trivial amount of work compared to the pattern
matching that will be done on that fact during retraction and/or
assertion. This is neither here nor there, in any case, because Jess's
current implementation of "modify" actually reuses the same Fact
object, and the fact-id is unchanged. The manual just hasn't been
updated to specifically reflect this, because it's an implementation
detail. Jess behaves "as if" modify were equivalent to a retract
followed by an assert.

> 
> Performance of (modify) function:
> ========================
> It seems (modify) = (retract) + (assert) with new value. If this is
> true, this will be against our "Benifit of modification".

Remember that the first rule of software optimization is "don't". The
second rule is that if you really have to, profile first, and fix
things that are actually problems. You're worrying about
micro-optimizations here, and in general, about things that should be
transparent to you as someone programming with Jess. A lot of work
goes into making Jess as performant as possible when used as
recommended, amortized over a whole application. Jess is a fairly
complicated system, and a lot is going on behind the scenes. If you
develop a prototype and it's slower than you need it to be, that's the
time to start worrying about this stuff. Otherwise, assume that Jess
is going to try to do the right thing as long as you program it
according to standard practice.

---------------------------------------------------------
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]
--------------------------------------------------------------------

Reply via email to