If Jess used unsorted Linear lists it would be O(s^2), but it uses some kind
of Hashtables. So it should be O(s). An explanation given by ernest some
time back says
"The Rete-memory data structures are most like hash tables, but they're
not java.util.Hashtables. The performance gain, which is real for
applications limited by Rete-memory lookup time, comes from an adptive
indexing algorithm. Basically the slots from which the hash code used
in each memory is generated are chosen based on the pattern
corresponding to that memory; given whatever the pattern needs to
access, the index key is chosen to make that access as fast as
possible."

-S.



-----Original Message-----
From: Thomas Barnekow [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 23, 2001 1:58 PM
To: Gyhra Norman (Student Assistant)
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: JESS: loading large factfiles


Hi!

> I use several deftemplates including
> inheritance and all the loaded facts are
> unordered facts. May this be a problem ?

Inheritance is definetely not the problem when asserting facts. When
defining a child deftemplate the parent deftemplate's slot definitions are
copied to
the child. When asserting an unordered fact the parent is not considered. 

My guess would be that asserting an unordered fact, whether or not its
deftemplate inherited from a parent deftemplate, should be at least part of
the
problem here. Look at the Fact class. Setting a single slot value has a
runtime
complexity of O(s) (an average of s/2 steps), where s is the number of
slots. This is because a slot index has to be looked up in an unsorted
linear list
of slots. Setting all slot values then requires s^2 / 2 steps, which is
O(s^2).

Thomas

P.S.: I don't have access to the Java code right now. This is what I
remember from a discussion I've had with Ernest some time ago. We discussed
using
some sort of associative memory (e.g., a Hashtable) instead of a linear
list.
Ernest thought that this might introduce to much of an overhead for average
deftemplates.

-- 
Sent through GMX FreeMail - http://www.gmx.net

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

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