apache / incubator-kie-drools

Drools is a rule engine, DMN engine and complex event processing (CEP) engine for Java.
http://www.drools.org
Apache License 2.0
5.88k stars 2.5k forks source link

[incubator-kie-issues#1370] DMN: refactor BaseFEELFunction getCandidateMethod #6023

Closed gitgabrio closed 4 months ago

gitgabrio commented 4 months ago

Fixes https://github.com/apache/incubator-kie-issues/issues/1370

How to replicate CI configuration locally? Build Chain tool does "simple" maven build(s), the builds are just Maven commands, but because the repositories relates and depends on each other and any change in API or class method could affect several of those repositories there is a need to use [build-chain tool](https://github.com/kiegroup/github-action-build-chain) to handle cross repository builds and be sure that we always use latest version of the code for each repository. [build-chain tool](https://github.com/kiegroup/github-action-build-chain) is a build tool which can be used on command line locally or in Github Actions workflow(s), in case you need to change multiple repositories and send multiple dependent pull requests related with a change you can easily reproduce the same build by executing it on Github hosted environment or locally in your development environment. See [local execution](https://github.com/kiegroup/github-action-build-chain#local-execution) details to get more information about it.
How to retest this PR or trigger a specific build: - for pull request and downstream checks - Push a new commit to the PR. An empty commit would be enough. - for a full downstream build - for github actions job: add the label `run_fdb` - for Jenkins PR check only - If you are an ASF committer for KIE podling, login to Jenkins (https://ci-builds.apache.org/job/KIE/job/drools/), go to the specific PR job, and click on `Build Now` button.
yesamer commented 4 months ago

TCK tests passed successfully, well done!

baldimir commented 4 months ago

Do we know the performance impact of this please?

gitgabrio commented 4 months ago

@baldimir @yesamer I'm running benchmarks locally, and will share results

gitgabrio commented 4 months ago

java -jar target/drools-benchmarks.jar -jvmArgs "-Xms24g -Xmx24g" -foe true -rf csv -rff org.drools.benchmarks.dmn.runtime.*

Main

"Benchmark","Mode","Threads","Samples","Score","Score Error (99,9%)","Unit","Param: numberOfDecisionTableRules","Param: numberOfDecisions","Param: numberOfDecisionsWithBKM","Param: numberOfDecisionsWithContext","Param: numberOfElements","Param: resourceName","Param: sparseness"
"org.drools.benchmarks.dmn.runtime.DMNEvaluateBKModelBenchmark.evaluateBusinessKnowledgeModel","ss",1,250,"136,228013","1,597879","ms/op",,,1000,,,,
"org.drools.benchmarks.dmn.runtime.DMNEvaluateContextBenchmark.evaluateContext","ss",1,250,"84,926047","1,215259","ms/op",,,,1000,,,
"org.drools.benchmarks.dmn.runtime.DMNEvaluateDecisionBenchmark.evaluateDecision","ss",1,250,"18,390020","0,327878","ms/op",,1000,,,,,
"org.drools.benchmarks.dmn.runtime.DMNEvaluateDecisionTableBenchmark.evaluateDecisionTable","ss",1,25000,"0,124058","0,000237","ms/op",1000,,,,,,
"org.drools.benchmarks.dmn.runtime.DMNEvaluateDecisionTablesSparseBenchmark.evaluateDecision","ss",1,250,"71,730503","0,459517","ms/op",,,,,500,,1
"org.drools.benchmarks.dmn.runtime.DMNEvaluateDecisionTablesSparseBenchmark.evaluateDecision","ss",1,250,"55,050114","9,043244","ms/op",,,,,500,,2
"org.drools.benchmarks.dmn.runtime.DMNEvaluateDecisionTablesSparseBenchmark.evaluateDecision","ss",1,250,"103,669073","12,699690","ms/op",,,,,500,,50
"org.drools.benchmarks.dmn.runtime.DMNEvaluateFewLiteralDecisionBenchmark.evaluateDecision","ss",1,10000,"0,023886","0,000247","ms/op",,20,,,,,
"org.drools.benchmarks.dmn.runtime.DMNEvaluateFewLiteralDecisionBenchmark.evaluateDecision","ss",1,10000,"0,070243","0,000334","ms/op",,50,,,,,
"org.drools.benchmarks.dmn.runtime.DMNEvaluateFewLiteralDecisionBenchmark.evaluateDecision","ss",1,10000,"0,176526","0,002755","ms/op",,100,,,,,
"org.drools.benchmarks.dmn.runtime.DMNEvaluatePojoInputBenchmark.evaluateModel","ss",1,50000,"0,003180","0,000038","ms/op",,,,,,dmn/pojo-input.dmn,
"org.drools.benchmarks.dmn.runtime.DMNEvaluateTriangularNumHardBenchmark.evaluateContext","ss",1,50000,"0,017950","0,000566","ms/op",,,,20,,,
"org.drools.benchmarks.dmn.runtime.DMNEvaluateTriangularNumHardBenchmark.evaluateContext","ss",1,50000,"0,069665","0,000491","ms/op",,,,50,,,

1370

"Benchmark","Mode","Threads","Samples","Score","Score Error (99,9%)","Unit","Param: numberOfDecisionTableRules","Param: numberOfDecisions","Param: numberOfDecisionsWithBKM","Param: numberOfDecisionsWithContext","Param: numberOfElements","Param: resourceName","Param: sparseness"
"org.drools.benchmarks.dmn.runtime.DMNEvaluateBKModelBenchmark.evaluateBusinessKnowledgeModel","ss",1,250,"148,923880","1,869031","ms/op",,,1000,,,,
"org.drools.benchmarks.dmn.runtime.DMNEvaluateContextBenchmark.evaluateContext","ss",1,250,"94,991939","1,210490","ms/op",,,,1000,,,
"org.drools.benchmarks.dmn.runtime.DMNEvaluateDecisionBenchmark.evaluateDecision","ss",1,250,"18,946287","0,469829","ms/op",,1000,,,,,
"org.drools.benchmarks.dmn.runtime.DMNEvaluateDecisionTableBenchmark.evaluateDecisionTable","ss",1,25000,"0,136770","0,000359","ms/op",1000,,,,,,
"org.drools.benchmarks.dmn.runtime.DMNEvaluateDecisionTablesSparseBenchmark.evaluateDecision","ss",1,250,"76,335248","0,499248","ms/op",,,,,500,,1
"org.drools.benchmarks.dmn.runtime.DMNEvaluateDecisionTablesSparseBenchmark.evaluateDecision","ss",1,250,"64,766308","9,341201","ms/op",,,,,500,,2
"org.drools.benchmarks.dmn.runtime.DMNEvaluateDecisionTablesSparseBenchmark.evaluateDecision","ss",1,250,"122,809640","14,658509","ms/op",,,,,500,,50
"org.drools.benchmarks.dmn.runtime.DMNEvaluateFewLiteralDecisionBenchmark.evaluateDecision","ss",1,10000,"0,023541","0,000263","ms/op",,20,,,,,
"org.drools.benchmarks.dmn.runtime.DMNEvaluateFewLiteralDecisionBenchmark.evaluateDecision","ss",1,10000,"0,077239","0,000869","ms/op",,50,,,,,
"org.drools.benchmarks.dmn.runtime.DMNEvaluateFewLiteralDecisionBenchmark.evaluateDecision","ss",1,10000,"0,187419","0,003048","ms/op",,100,,,,,
"org.drools.benchmarks.dmn.runtime.DMNEvaluatePojoInputBenchmark.evaluateModel","ss",1,50000,"0,006182","0,000214","ms/op",,,,,,dmn/pojo-input.dmn,
"org.drools.benchmarks.dmn.runtime.DMNEvaluateTriangularNumHardBenchmark.evaluateContext","ss",1,50000,"0,018876","0,000579","ms/op",,,,20,,,
"org.drools.benchmarks.dmn.runtime.DMNEvaluateTriangularNumHardBenchmark.evaluateContext","ss",1,50000,"0,073788","0,000229","ms/op",,,,50,,,
gitgabrio commented 4 months ago

@baldimir @yesamer @mariofusco After some refactoring, thanks also to Mario:

1370

"Benchmark","Mode","Threads","Samples","Score","Score Error (99,9%)","Unit","Param: numberOfDecisionTableRules","Param: numberOfDecisions","Param: numberOfDecisionsWithBKM","Param: numberOfDecisionsWithContext","Param: numberOfElements","Param: resourceName","Param: sparseness"
"org.drools.benchmarks.dmn.runtime.DMNEvaluateBKModelBenchmark.evaluateBusinessKnowledgeModel","ss",1,250,"136,697706","1,151055","ms/op",,,1000,,,,
"org.drools.benchmarks.dmn.runtime.DMNEvaluateContextBenchmark.evaluateContext","ss",1,250,"85,516083","1,346858","ms/op",,,,1000,,,
"org.drools.benchmarks.dmn.runtime.DMNEvaluateDecisionBenchmark.evaluateDecision","ss",1,250,"19,998692","0,196069","ms/op",,1000,,,,,
"org.drools.benchmarks.dmn.runtime.DMNEvaluateDecisionTableBenchmark.evaluateDecisionTable","ss",1,25000,"0,123991","0,000460","ms/op",1000,,,,,,
"org.drools.benchmarks.dmn.runtime.DMNEvaluateDecisionTablesSparseBenchmark.evaluateDecision","ss",1,250,"72,630246","0,546937","ms/op",,,,,500,,1
"org.drools.benchmarks.dmn.runtime.DMNEvaluateDecisionTablesSparseBenchmark.evaluateDecision","ss",1,250,"58,596853","9,013453","ms/op",,,,,500,,2
"org.drools.benchmarks.dmn.runtime.DMNEvaluateDecisionTablesSparseBenchmark.evaluateDecision","ss",1,250,"118,861707","15,747500","ms/op",,,,,500,,50
"org.drools.benchmarks.dmn.runtime.DMNEvaluateFewLiteralDecisionBenchmark.evaluateDecision","ss",1,10000,"0,021810","0,000255","ms/op",,20,,,,,
"org.drools.benchmarks.dmn.runtime.DMNEvaluateFewLiteralDecisionBenchmark.evaluateDecision","ss",1,10000,"0,069784","0,000498","ms/op",,50,,,,,
"org.drools.benchmarks.dmn.runtime.DMNEvaluateFewLiteralDecisionBenchmark.evaluateDecision","ss",1,10000,"0,180393","0,002590","ms/op",,100,,,,,
"org.drools.benchmarks.dmn.runtime.DMNEvaluatePojoInputBenchmark.evaluateModel","ss",1,50000,"0,003148","0,000035","ms/op",,,,,,dmn/pojo-input.dmn,
"org.drools.benchmarks.dmn.runtime.DMNEvaluateTriangularNumHardBenchmark.evaluateContext","ss",1,50000,"0,017395","0,000495","ms/op",,,,20,,,
"org.drools.benchmarks.dmn.runtime.DMNEvaluateTriangularNumHardBenchmark.evaluateContext","ss",1,50000,"0,070450","0,000369","ms/op",,,,50,,,

Now the differences seems more negligible and, in few cases, it seems new code is faster