[jboss-jira] [JBoss JIRA] (DROOLS-667) Profile why day.index is so much slower than day.getIndex()

Mario Fusco (JIRA) issues at jboss.org
Mon Dec 15 11:42:30 EST 2014


    [ https://issues.jboss.org/browse/DROOLS-667?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13027733#comment-13027733 ] 

Mario Fusco commented on DROOLS-667:
------------------------------------

I made the use case to run for a bit longer (100+ seconds) and I cannot reproduce any relevant difference. Using day.index I got this:

2014-12-15 17:03:50,345 [SwingWorker-pool-3-thread-1] INFO  Solving ended: time spent (102397), best score (0hard/-815683soft), average calculate count per second (407), environment mode (REPRODUCIBLE).

while with day.getIndex() I have:

2014-12-15 17:06:57,316 [SwingWorker-pool-3-thread-1] INFO  Solving ended: time spent (102024), best score (0hard/-815683soft), average calculate count per second (404), environment mode (REPRODUCIBLE).

I pushed an optimization that normalizes a getter (e.g.: 'getIndex()') to the corresponding fieldName (e.g.: 'index') when generating the field accessor inside the PatternBuilder: https://github.com/droolsjbpm/drools/commit/7084221cf
However this optimization is not related with the TravelingTournamentApp use case because all the accessors in that drl need a further level of indirection like in day.index or day.getIndex().

Please try to profile this use case on your machine and figure out what's the difference there. 
 

> Profile why day.index is so much slower than day.getIndex()
> -----------------------------------------------------------
>
>                 Key: DROOLS-667
>                 URL: https://issues.jboss.org/browse/DROOLS-667
>             Project: Drools
>          Issue Type: Enhancement
>    Affects Versions: 6.2.0.CR3
>            Reporter: Geoffrey De Smet
>            Assignee: Mario Fusco
>
> day.index is 3 times slower than day.getIndex() (and it's gets more as the dataset grows)
> As discussed with Mario. Rough benchmark speeds here:
>   https://gist.github.com/ge0ffrey/7662856f357dbec7f7ec
> Reproduce recipe
> - git clone optaplanner
> - Run TravelingTournamentApp, load dataset bra24, solve it for about 30 seconds.
> - Open travelingTournamentScoreRules.drl. Replace all occurrences of "day.getIndex()" with "day.index".
> - Run TravelingTournamentApp again, load dataset bra24, solve it for about 30 seconds again.
> - Compare the last log message of both runs: look for average calculate count per second (x). Higher is faster. For bra24, day.getIndex() is 3 times faster than day.index.



--
This message was sent by Atlassian JIRA
(v6.3.11#6341)


More information about the jboss-jira mailing list