Description of problem: Building kbase (with drools 6) with DSL/DSLR resources takes longer when comparing to building drools 5 kbase with same resources. See attached Maven based reproducer for more info. For example on my machine the results are following: - drools5: ~5s - drools6: ~7s => difference ~40 % Version-Release number of selected component (if applicable): 6.0.0.Beta5 (and current snapshot) Steps to Reproduce: 1. Run the attached reproducer for both drools versions (mvn test) 2. Compare the execution times that are being printed to stdout Actual results: Building kbase from DSL/DSLR takes longer comparing to drools 5 Expected results: KBase build time for drools 6 is better or ~same as for drools 5
Created attachment 770923 [details] Maven based reproducer
The performance degradation has been mainly caused by the addition of some new features like named consequences, inline casts, grouped accessors, etc. that even if not used in the provided test case increase the complexity of the drl parser and compiler. With this commit https://github.com/droolsjbpm/drools/commit/eae854a7d5f8e86cf41f48c13d4cfef2a134139b I tried to do some optimizations like caching the hashcode of the AlphaNodes and parallelizing the wiring of the generated class. At the moment the performance difference between the 5.3 and 6.0 on my machine is less than 10%, but I have a 4 cores cpu and I expect an even smaller gap (or none at all) on a pc with 8+ cores due to that parallelization I was mentioning above.
Latest test result shows no difference between 5.3.1-P04 and 6.0.0-ER4, so I am marking this as verified.