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

Sonata plz.write.to at gmail.com
Sun May 12 07:29:57 EDT 2013


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.


More information about the rules-users mailing list