[jboss-jira] [JBoss JIRA] Commented: (JBRULES-2685) Performance degradation from 5.0.1 to 5.1.0
Mark Proctor (JIRA)
jira-events at lists.jboss.org
Wed May 18 23:25:01 EDT 2011
[ https://issues.jboss.org/browse/JBRULES-2685?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12603092#comment-12603092 ]
Mark Proctor commented on JBRULES-2685:
---------------------------------------
I've found the issue. The problem is 'from' in 5.1+ is more intellgient than in 5.0.1. In 5.0.1 each left propagation for retract or modify would throw away the right matchines and redo them again, there was no state managemetn. In 5.1+ we keep the resulting tuples in a Map and then when the 'from' is executed again we "diff" so we know what previously existed and what is new - this is necessary to keep intermediate results in situations like 'accumulate'.
This level of state management has a cost. I might be able to alleviate it by changing the Map implementation from a LinkedHashMap to a custom one that uses the RightTuple as the Entry.
> Performance degradation from 5.0.1 to 5.1.0
> -------------------------------------------
>
> Key: JBRULES-2685
> URL: https://issues.jboss.org/browse/JBRULES-2685
> Project: Drools
> Issue Type: Quality Risk
> Security Level: Public(Everyone can see)
> Components: drools-core
> Affects Versions: 5.1.0.FINAL
> Environment: OSX 10.6.4
> Reporter: Greg Barton
> Assignee: Edson Tirelli
> Priority: Minor
> Fix For: 5.2.0.CR1
>
> Attachments: DroolsNested2.zip
>
>
> I've observed a sizable (25%) performance degradation between the 5.0.1 and 5.1.0 releases. I've attached a sample project that tests the performance of matching nested objects. (ANd compares direct reference matching and the performance pitfalls of "from," but that's beside the current point.)
> If you switch the pom.xml from using 5.0.1 to 5.1.0 for the drools dependencies you'll see 25% longer execution times on the tests. (mvn test)
> Here's the test output:
> 5.0.1
> reference.drl Count: 2000
> reference.drl Time: 267ms
> reference.drl Time per element: 0.1335ms
> BAR Duplicates: 780
> FOO Duplicates: 880
> reference.drl Count: 20000
> reference.drl Time: 1249ms
> reference.drl Time per element: 0.06245ms
> BAR Duplicates: 7702
> FOO Duplicates: 8040
> from.drl Count: 200
> from.drl Time: 1139ms
> from.drl Time per element: 5.695ms
> BAR Duplicates: 112
> FOO Duplicates: 102
> reference.drl Count: 200
> reference.drl Time: 5ms
> reference.drl Time per element: 0.025ms
> BAR Duplicates: 86
> FOO Duplicates: 60
> 5.1.0
> reference.drl Count: 2000
> reference.drl Time: 300ms
> reference.drl Time per element: 0.15ms
> BAR Duplicates: 788
> FOO Duplicates: 820
> reference.drl Count: 20000
> reference.drl Time: 1564ms
> reference.drl Time per element: 0.0782ms
> BAR Duplicates: 8142
> FOO Duplicates: 7960
> from.drl Count: 200
> from.drl Time: 3543ms
> from.drl Time per element: 17.715ms
> BAR Duplicates: 68
> FOO Duplicates: 90
> reference.drl Count: 200
> reference.drl Time: 13ms
> reference.drl Time per element: 0.065ms
> BAR Duplicates: 84
> FOO Duplicates: 74
> On the most taxing test (20k objects) 5.0.1 took 1249ms while 5.1.0 took 1564ms, and for larger tests the effect is more pronounced. This is primarily a test of == on object references.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list