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