We don't really try to optimize rule compilation time; in general,
time taken to compile rules is supposed to pay off later when they're
used. The function calls in the second form of rule are going to get
expanded and combined, and Jess is going to try to transform them into
direct pattern matches, and a lot of work gets done as Jess figures
out the best way to do it. There's also the simple matter of merging
the rules into a single network, which ultimately comes down to
figuring out if there are duplicate pattern matches across rules;
comparing function-call objects is more expensive than comparing tests
against literals.
On Oct 1, 2008, at 6:19 PM, Adair, John wrote:
Would you expect to see dramatically different parse times for the
following rules?
(defrule r0
(R (ProductFamily "campaign_02703")
(SKU "2989")
(_r ?o)
) => (?o a (rx))
)
(defrule r0
(R (ProductFamily ?ProductFamily&:(eq ?ProductFamily
"campaign_02703")|nil)
(SKU ?SKU&:(eq ?SKU "2989")|nil)
(_r ?o)
) => (?o a (rx))
)
For 6,600 rules of the first form, the parse time is below 3
seconds, but for
the same number of rules of the second form, the parse time is above
10 seconds.
These times are on 7.1, although my investigation was prompted by a
performance
problem in our production app, which is on 7.0, so it should be
similar there.
--------------------------------------------------------------------
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
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]
--------------------------------------------------------------------