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