Hi.<br><br>My environment: Win XP SP3, 2x2.13 GHz cpu, 3GB RAM, Drools 4.0.7, JDK 1.4.2_11, java compiler: JANINO, dialect: java.<br><br>We have about 850 drl&#39;s with 5 - 10 conditions in each. 0 -2 evals in each. The drl&#39;s only contain one rule each.<br>


<br>We are using Drools programatically by compiling the drls using PackageBuilder.<div id=":11d" class="ii gt">addPackageFromDrl and adding them to a RuleBase using RuleBase.addPackage(PackageBuilder.getPackage())<br><br>
When
we are building our rule base we are never able to compile more than 1
-2 rules per second, which means we need over 10 minutes (at 100% cpu)
to build our rulebase.<br>

<br>Profiling shows 68% cpu time in org.drools.rule.builder.GroupElementBuilder.build and 18% cpu time in org.codehaus.janino.Compiler.compile.<br><br>We have experimented by changing the compiler to ECLIPSE and the dialect to mvel but the results are the same.<br>


<br>We have experimented using one PackageBuilder instance per drl or
grouping drls by package and sharing a builder per package. Same result
in both scenarios. <br><br>We have also expermimented with compiling concurrently in serveral threads. Again, about the same result. <br>

<br>My question is: Is this the performance we can expect from the compiler or are we doing something fundamentally wrong?<br><br>Below
is an example of one of our drls. This one contains no evals, but still
takes more than 1 second to compile. If anyone can spot some issues
with the way we are doing things the feedback would be much apreciated
:)<br>

<br>------------------------------------<br>package domain.core.productoffer.rules.subscriptiontype<br><br>import type.productoffer.ProductOfferRuleEvent<br>import domain.core.subscription.Subscription<br>import domain.core.subscription.SubscribedService<br>


import type.subscription.ActionTypeEnum<br>import domain.core.productoffer.ProductOffer<br>import domain.rules.RuleEvent<br><br>global domain.core.productoffer.RuleValidationReport validationResult<br><br><br>rule &quot;RequiredVProducts&quot;<br>


    when<br>        ProductOfferRuleEvent(id == &#39;3&#39;)<br>        ProductOffer(id.value  == 31963)<br><br>        $subscription:Subscription()<br>        <br>       
not (  SubscribedService(status != ActionTypeEnum.REMOVE_CANCEL
&amp;&amp; productId.value in (57, 69) ) from $subscription.getAllChildSubscribedServices())<br>

    then<br>        validationResult.addValidationMessage(&quot;2069&quot;,
&quot;For product offer rule event with id &#39;3&#39; and product offer with
id=31963 subscription must have one of the following VProducts: 57,
69.&quot;);<br>

end<br>------------------------------------<br>
<br>Regards<br><font color="#888888">Christian Nedregård<br></font></div>