That looks great, presumably it makes little difference on the actual running times of the rules?

 

The thing I’d really like to be optimized is rule compilation and load time (particularly as it seems to be getting slower!), however I’ve a feeling that it may not be as simple a thing to improve!

 

Thomas

 

From: rules-dev-bounces@lists.jboss.org [mailto:rules-dev-bounces@lists.jboss.org] On Behalf Of Mario Fusco
Sent: 26 September 2011 09:44
To: rules-dev@lists.jboss.org
Subject: [rules-dev] Optimizing working memory

 

Hi,

as suggested by Mark, last Thursday I pushed some optimization to the working memory.

https://github.com/droolsjbpm/drools/commit/763ebf8d23d5f9ab0a47774c23aa719f514ec021

As you can see I basically lazy initialized all the non-strictly necessary data structures and rewrote the updateEntryPointsCache method. Now I also had time to benchmark these improvements in terms of both memory occupation and speed. I did this by just creating a StatefulKnowledgeSession starting from a KnowledgeBase with a single simple rule.

Before my optimization, each StatefulKnowledgeSession occupied 11,336 bytes and I can create (on my machine) 4,668 of them in one second.
After it, each StatefulKnowledgeSession is now 8,610 bytes and in one second I can create 12,304 of them.

I guess those results are truly positive and interesting especially if compared with the time (just a few hours) I needed to implement them.
Would be great If you think there are other parts of the project where it could be possible to achieve similar results and then you could signal them.

Mario Fusco
twitter: http://twitter.com/#!/mariofusco




**************************************************************************************
This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the postmaster@nds.com and delete it from your system as well as any copies. The content of e-mails as well as traffic data may be monitored by NDS for employment and security purposes. To protect the environment please do not print this e-mail unless necessary.

NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, United Kingdom. A company registered in England and Wales. Registered no. 3080780. VAT no. GB 603 8808 40-00
**************************************************************************************