[rules-users] Time Taken To Load Rule Resource

Esteban Aliverti esteban.aliverti at gmail.com
Mon May 17 09:31:36 EDT 2010


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 at 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 at lists.jboss.org [mailto:
> rules-users-bounces at 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 at 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 at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
>
>
> --
> XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
>
> Esteban Aliverti
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>


-- 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Esteban Aliverti
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100517/eef179f7/attachment.html 


More information about the rules-users mailing list