[rules-users] Room to optimize or bug? Unnecessary calls to unused method

Mark Proctor mproctor at codehaus.org
Sun May 12 13:30:13 EDT 2013


The code examples of what you are proposing did not make it to the list.

Mark
On 12 May 2013, at 12:29, Sonata <plz.write.to at gmail.com> wrote:

> Hi, I am using 5.5.0.final on jdk7(64bit). To repeat the test, simply create
> a new Drools project in Eclipse. Tick the option to create a default Hello
> World project. Go to the DroolsTest.java file, edit main() to
> 
> 
> and edit getMessage() to
> 
> 
> Next, remove the two rules in Sample.drl, use this simple rule instead
> 
> 
> Then you can see the output
> 
> 
> Which means, getMessage() is called 4 times in this simple rule. I really
> wonder why. Is this a bug? Some non-optimized routine? An edge case?
> 
> Now try this
> 
> and the output is
> 
> 
> Just once. It seems all good. Because getMessage() is needed to call once to
> check with null, which is very fair to me.
> 
> Now something really funny
> 
> 
> and the output
> 
> 
> 
> An extra call to getMessage() at the end, total 5 times!
> 
> TBH, I really only expect calling getMessage() once in all these tests.
> Please put it to my face and tell me my test is so flawed. 
> 
> 
> 
> --
> View this message in context: http://drools.46999.n3.nabble.com/Room-to-optimize-or-bug-Unnecessary-calls-to-unused-method-tp4023790.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users




More information about the rules-users mailing list