Hi,

 

Thanks for the help!

 

I have tried implemented your idea by creating a method that compiles the rules resources (DRL and RF files). But I keep getting a

 

java.lang.RuntimeException: java.io.EOFException

 

error when I call kbuilder.add(ResourceFactory.newFileResource("/some/file.pkg"), ResourceType.PKG); 

 

Any ideas?

 

- Ade


From: rules-users-bounces@lists.jboss.org [mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Esteban Aliverti
Sent: 17 May 2010 14:32
To: Rules Users List
Subject: Re: [rules-users] Time Taken To Load Rule Resource

 

Yes, you can compile your rules once and save them as binary files. Here is a code snippet to do that:

 

                KnowledgePackage pkg = (KnowledgePackage) kbuilder            .getKnowledgePackages().iterator().next();

                FileOutputStream out = new FileOutputStream("/some/file.pkg");

                        try {

                                    DroolsStreamUtils.streamOut(out, pkg);

                        } finally {

                                    out.close();

                        }

 

The code above only uses kbuilder's first package.

The way you load a binary package is the same as you do for DRL files:

 

                        kbuilder.add(ResourceFactory.newFileResource("/some/file.pkg", ResourceType.PKG); 

 

Hope you find this useful!

 

Best,

 

2010/5/17 Adeyinka Timi <adeyinka.timi@nathean.com>

Thanks for your reply!

No particular reason. Is there a better of going about this – avoid compilation of rules everytime?

 


From: rules-users-bounces@lists.jboss.org [mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Esteban Aliverti
Sent: 17 May 2010 14:09
To: Rules Users List
Subject: Re: [rules-users] Time Taken To Load Rule Resource

 

Is there any reason why you need to compile the rules every time your app starts? 

2010/5/17 Adeyinka Timi <adeyinka.timi@nathean.com>

Hi guys,

 

I have a drools application running that takes about 7 seconds to run. 5 seconds of this time is used in parsing 2 DRL files that 200kb (6200 lines of code) and 34kb (1400 lines of code). Do you guys have any tips or any techniques that I can use to improve performance?

 

 

- Ade


_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users




--
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Esteban Aliverti


_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users




--
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Esteban Aliverti