On Nov 5, 2008, at 3:38 AM, Wolfgang Laun wrote:
But the interesting question is: does this difference in behavior imply that there is some difference in efficiency between these matches?
Yes, actually. The goal is that eventually Jess will transform all three of these into the exact same Rete network, but that doesn't quite happen yet.
In Jess 7.1p1, the second version is, in fact, recognized as identical to the first, and so those two are represented the same way: by a direct slot comparison in the "join" node. Furthermore, the join node indices are organized around the contents of those slots that are compared in that test, so the comparison is very efficient.
The third one is partially transformed, but the explicit function call remains, and as a result the join node memories are unindexed. This is not just laziness on Jess' part; evaluating the function last, after the join is done, is part of the semantics of the "test" CE, and in the most general case, it has to be done that way to be correct (an early alpha of Jess 7.1 did NOT preserve these semantics, and this was reported as a bug.)
In this specific case, it actually doesn't matter, and I'd like Jess to be smart enough to recognize this kind of exception to the rule -- but right now it does not, so the "test" version is not as efficient as the others. But I think the reason this rule works, and the others don't, is because the Rete memories are unindexed. The missing hashCode() method results in corrupt indexes for the other two rules, but this one is immune to the problem.
--------------------------------------------------------- Ernest Friedman-Hill Informatics & Decision Sciences, Sandia National Laboratories PO Box 969, MS 9012, Livermore, CA 94550 http://www.jessrules.com -------------------------------------------------------------------- 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] --------------------------------------------------------------------
