<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=text/html;charset=iso-8859-1 http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.18828"></HEAD>
<BODY style="PADDING-LEFT: 10px; PADDING-RIGHT: 10px; PADDING-TOP: 15px" 
id=MailContainerBody leftMargin=0 topMargin=0 CanvasTabStop="true" 
name="Compose message area">
<DIV><FONT face=Calibri>Group,</FONT></DIV>
<DIV><FONT face=Calibri>The following HelloWorld example is taken from the 
example code coming with the latest Drools downloads.&nbsp;One modification is 
the addition of the loop(10K times). Please note that the loading of the drl 
file is outside of this loop.&nbsp; Our developer tells us that this same 
example runs in 300milliseconds in Drools 2.0.&nbsp;&nbsp; Version 5.0 runs for 
10 seconds. We have a large batch process that will suffer greatly if this is 
something we can't work around. Any ideas for performance gains in 5.0 will be 
greatly appreciated.</FONT></DIV>
<DIV><FONT face=Calibri></FONT>&nbsp;</DIV>
<DIV><FONT face=Calibri>Duane</FONT></DIV>
<DIV><FONT face=Calibri><A 
href="mailto:duane@proqualitysoft.com">duane@proqualitysoft.com</A></FONT></DIV>
<DIV><FONT face=Calibri></FONT>&nbsp;</DIV>
<DIV><FONT face=Calibri>public static final void main(final String[] args) 
throws Exception {<BR>&nbsp;&nbsp;final KnowledgeBuilder kbuilder = 
KnowledgeBuilderFactory.newKnowledgeBuilder();</FONT></DIV>
<DIV><FONT face=Calibri></FONT>&nbsp;</DIV>
<DIV><FONT face=Calibri>&nbsp;&nbsp;// this will parse and compile in one 
step<BR>&nbsp;&nbsp;kbuilder.add(ResourceFactory.newClassPathResource("HelloWorld.drl",<BR>&nbsp;&nbsp;&nbsp;&nbsp;HelloWorldExample.class), 
ResourceType.DRL);</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Calibri>&nbsp;&nbsp;// Check the builder for 
errors<BR>&nbsp;&nbsp;if (kbuilder.hasErrors()) 
{<BR>&nbsp;&nbsp;&nbsp;System.out.println(kbuilder.getErrors().toString());<BR>&nbsp;&nbsp;&nbsp;throw 
new RuntimeException("Unable to compile 
\"HelloWorld.drl\".");<BR>&nbsp;&nbsp;}</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Calibri>&nbsp;&nbsp;// get the compiled packages (which are 
serializable)<BR>&nbsp;&nbsp;final Collection&lt;KnowledgePackage&gt; pkgs = 
kbuilder.getKnowledgePackages();</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Calibri>&nbsp;&nbsp;// add the packages to a knowledgebase 
(deploy the knowledge packages).<BR>&nbsp;&nbsp;final KnowledgeBase kbase = 
KnowledgeBaseFactory.newKnowledgeBase();<BR>&nbsp;&nbsp;kbase.addKnowledgePackages(pkgs);</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Calibri>&nbsp;&nbsp;final StatefulKnowledgeSession ksession = 
kbase.newStatefulKnowledgeSession();<BR>&nbsp;&nbsp;ksession.setGlobal("list", 
new ArrayList&lt;Object&gt;());</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Calibri>&nbsp;&nbsp;ksession.addEventListener(new 
DebugAgendaEventListener());<BR>&nbsp;&nbsp;ksession.addEventListener(new 
DebugWorkingMemoryEventListener());</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Calibri>&nbsp;&nbsp;// setup the audit 
logging<BR>&nbsp;&nbsp;KnowledgeRuntimeLogger logger = 
KnowledgeRuntimeLoggerFactory<BR>&nbsp;&nbsp;&nbsp;&nbsp;.newFileLogger(ksession, 
"log/helloworld");<BR>&nbsp;&nbsp;long starttime = 
System.currentTimeMillis();<BR>&nbsp;&nbsp;for(int 
u=0;u&lt;10000;u++)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;final Message message = new 
Message();<BR>&nbsp;&nbsp;&nbsp;message.setMessage("Hello 
World");<BR>&nbsp;&nbsp;&nbsp;message.setStatus(Message.HELLO);<BR>&nbsp;&nbsp;&nbsp;ksession.insert(message);<BR>&nbsp;&nbsp;&nbsp;ksession.fireAllRules();<BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp; 
long endtime = 
System.currentTimeMillis();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
System.out.println("execution time is 
"+(endtime-starttime));<BR>&nbsp;&nbsp;logger.close();</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT 
face=Calibri>&nbsp;&nbsp;ksession.dispose();<BR>&nbsp;}</FONT></DIV></BODY></HTML>