Skip to content

Instantly share code, notes, and snippets.

View lucamolteni's full-sized avatar
🏠
Working from home

Luca Molteni lucamolteni

🏠
Working from home
View GitHub Profile
Dne 18. 03. 20 v 11:41 Luca Molteni napsal(a):
> Speaking of coding without a computer, do you think it's too early to buy a cubetto (https://www.primotoys.com/) for a
> three-year old?
In this early stage, it is very hard to give piece of advice based on years.
Cubetto can be pretty fine or not.
You should make your decision on what your kid is capable of. For this, most teachers use Piaget's theory:
https://en.wikipedia.org/wiki/Piaget's_theory_of_cognitive_development
```va.lang.RuntimeException: Unable to load dialect 'org.drools.compiler.rule.builder.dialect.java.JavaDialectConfiguration:java:org.drools.compiler.rule.builder.dialect.java.JavaDialectConfiguration'
at org.drools.compiler.builder.impl.KnowledgeBuilderConfigurationImpl.addDialect(KnowledgeBuilderConfigurationImpl.java:405)
at org.drools.compiler.builder.impl.KnowledgeBuilderConfigurationImpl.buildDialectConfigurationMap(KnowledgeBuilderConfigurationImpl.java:391)
at org.drools.compiler.builder.impl.KnowledgeBuilderConfigurationImpl.init(KnowledgeBuilderConfigurationImpl.java:239)
at org.drools.compiler.builder.impl.KnowledgeBuilderConfigurationImpl.init(KnowledgeBuilderConfigurationImpl.java:191)
at org.drools.compiler.builder.impl.KnowledgeBuilderConfigurationImpl.<init>(KnowledgeBuilderConfigurationImpl.java:159)
at org.drools.compiler.kie.builder.impl.AbstractKieProject.getBuilderConfiguration(AbstractKieProject.java:302)
at org.drools.modelcompiler.builder.CanonicalModelKieProject.createKnowledgeB
module Main where
main = return ()
{--
func 2 3
=> False
func 3 3
=> False
did you give a try to my fix to index generation? Any feedback?
On my side I have very good news for what regards the load time of the kjar generated with the executable model. As I wrote in my former email we are doing our experiments with a reduced version of your original reproducer with only 1 package and 10K rules. As anticipated, before the optimization work that we're doing loading that kjar from plain drl (without the executable model) took 10 seconds while using the executable model required 14 seconds.
The first experiment that I've done has been parallelizing (for large rule sets as this) how the executable model classes are loaded. This lowered the original 14 seconds to around 6.5 on my laptop and I expect even better improvements on a more beefed hardware.
However what has been a real game changer is the other improvement suggested by Luca and on which he worked in the last days. What he did was rewriting how the lambdas used in the executable model are generated. Now instead of being inlined
Index: drools-model/drools-model-compiler/src/test/java/org/drools/modelcompiler/CompilerTest.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- drools-model/drools-model-compiler/src/test/java/org/drools/modelcompiler/CompilerTest.java (revision c9b7e7a653ce77afaaea4bc0c202ac4ce1e2987b)
+++ drools-model/drools-model-compiler/src/test/java/org/drools/modelcompiler/CompilerTest.java (date 1580908907820)
@@ -2001,4 +2001,23 @@
assertEquals( 1, ksession.fireAllRules() );
DRL
===================
[EntryPointNode(1) EntryPoint::DEFAULT ]
[ObjectTypeNode(4)::EntryPoint::DEFAULT objectType=[ClassObjectType event=org.drools.modelcompiler.domain.StockTick] expiration=-1ms ]
[AlphaNode(5) constraint=isSetDueDate == true]
[ AccumulateNode(6) ]
[RuleTerminalNode(7): rule=AccumulateMaxDate]
[ObjectTypeNode(2)::EntryPoint::DEFAULT objectType=[ClassObjectType class=org.drools.core.reteoo.InitialFactImpl] expiration=-1ms ]
[LeftInputAdapterNode(3)]
[ AccumulateNode(6) ]
package org.drools.modelcompiler.builder.generator.visitor.accumulate;
import java.util.List;
import java.util.Optional;
import com.github.javaparser.StaticJavaParser;
import com.github.javaparser.ast.Node;
import com.github.javaparser.ast.expr.Expression;
import com.github.javaparser.ast.expr.MethodCallExpr;
import com.github.javaparser.printer.PrettyPrinter;
org.drools.model.Rule rule = D.rule("org.acme.test_generateModel_kjararchetype",
"will execute per each Measurement having ID color").attribute(Rule.Attribute.NO_LOOP,
true)
.build(D.pattern(var_GENERATED_$pattern_Measurement$1$).expr("819AEEBB391F281267C56FEF6FFF8D0E",
org.acme.test_generateModel_kjararchetype.LambdaPredicate8A083A1BFD61A2FB8590738F7DC4ADC3.INSTANCE,
D.alphaIndexedBy(java.lang.String.class,
package org.optaweb.employeerostering.service.solver
import org.optaweb.employeerostering.domain.employee.EmployeeAvailabilityState
import org.optaplanner.core.api.score.buildin.hardmediumsoftlong.HardMediumSoftLongScoreHolder
import java.time.Duration
import org.optaweb.employeerostering.domain.skill.Skill
import org.optaweb.employeerostering.domain.spot.Spot
import org.optaweb.employeerostering.domain.common.DateTimeUtils
import java.time.temporal.IsoFields
import org.optaweb.employeerostering.domain.roster.Roster
[INFO] Reactor Summary:
[INFO]
[INFO] Drools and jBPM integration multiproject ........... SUCCESS [ 13.273 s]
[INFO] KIE :: Swagger UI .................................. SUCCESS [ 2.052 s]
[INFO] KIE Identity And Session Provider .................. SUCCESS [ 25.875 s]
[INFO] OptaPlanner Workbench models ....................... SUCCESS [ 0.258 s]
[INFO] Drools data model API implementations for OptaPlanner Workbench SUCCESS [ 19.404 s]
[INFO] KIE :: Maven Plugin ................................ SUCCESS [ 43.942 s]
[INFO] KIE :: Takari Plugin ............................... SUCCESS [ 55.129 s]
[INFO] Drools Benchmark ................................... SUCCESS [ 18.497 s]