[rules-users] Why would addPackageFromDrl() takes more time even for a small drl file with one rule

Edson Tirelli tirelli at post.com
Thu Jan 25 07:02:16 EST 2007


   Raja,

   Loading a DRL includes parsing source code, target code generation 
and compilation among other things. It's the heaviest part of the cycle, 
but it improves runtime performance.
   We are working on making it faster, but for now, what I can suggest 
is, for cases where it is possible, to compile the rulebase once and 
cache it to use throughout the application. Also, you can serialize the 
compiled rulebase and deserialize when needed. 
Serialization/deserialization is much lighter than compilation.
   Also, in trunk, I implemented a simple ant task to allow 
compilation/serialization of a rulebase as part of the build process of 
your application. You may want to take a look.

   []s
   Edson


Raja.Bobbala at sanofi-aventis.com wrote:

> I have the following code to add a drl to the package.It takes 2-3 
> secs to load even a small drl file with one rule.
> Appreciate if anyone in the group throw some light on this.
>
> PackageBuilder builder = new PackageBuilder();
> Date startTime = new Date();
> SimpleDateFormat formatter = new SimpleDateFormat("H:mm:ss:SSS");
> String datenewformat = formatter.format(startTime);
> System.out.println("Before Add Package from DRL-->" + datenewformat);
> builder.addPackageFromDrl( new InputStreamReader( 
> getClass().getResourceAsStream( "/test.drl" )));
>
> Date endTime = new Date();
> SimpleDateFormat formatter1 = new SimpleDateFormat("H:mm:ss:SSS");
> String datenewformat1 = formatter1.format(endTime);
> System.out.println("After Add Package from DRL-->" + datenewformat1);
>
>------------------------------------------------------------------------
>
>_______________________________________________
>rules-users mailing list
>rules-users at lists.jboss.org
>https://lists.jboss.org/mailman/listinfo/rules-users
>  
>


-- 
 Edson Tirelli
 Software Engineer - JBoss Rules Core Developer
 Office: +55 11 3124-6000
 Mobile: +55 11 9218-4151
 JBoss, a division of Red Hat @ www.jboss.com





More information about the rules-users mailing list