-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[incubator-kie-issues#780] DMN - Benchmarking InfixOpNode and InfixOp…
…erators (#281) * [dmn-infixopnode-benchmark] Benchmarking infixopnode * [incubator-kie-issues#781] Benchmarking infixopnode * [incubator-kie-issues#781] Benchmarking infixexecutors * [incubator-kie-issues#781] Fix as per PR suggestion * [incubator-kie-issues#780] Benchmarking infixopnode * [incubator-kie-issues#780] Benchmarking infixexecutors * [incubator-kie-issues#780] Fix as per PR suggestion --------- Co-authored-by: BAMOE CI <[email protected]>
- Loading branch information
Showing
15 changed files
with
854 additions
and
0 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
.../drools-benchmarks/src/main/java/org/drools/benchmarks/dmn/feel/FEELInfixOpBenchmark.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Copyright 2018 Red Hat, Inc. and/or its affiliates. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.drools.benchmarks.dmn.feel; | ||
|
||
import org.openjdk.jmh.annotations.Param; | ||
import org.openjdk.jmh.annotations.Warmup; | ||
|
||
import java.util.concurrent.TimeUnit; | ||
|
||
@Warmup(iterations = 30, time = 200, timeUnit = TimeUnit.MILLISECONDS) | ||
public class FEELInfixOpBenchmark extends AbstractFEELBenchmark { | ||
|
||
@Param({"30 >= 20 * 10", "16 / 5 * ( 7 )", "9 + 5 ** 3", "10 * 32", "34 < 10 and 43 = \"32\" or 23"}) | ||
private String expression; | ||
|
||
@Override | ||
public String getExpression() { | ||
return expression; | ||
} | ||
|
||
} |
58 changes: 58 additions & 0 deletions
58
...src/main/java/org/drools/benchmarks/dmn/feel/infixexecutors/FEELAddExecutorBenchmark.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/** | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* <p> | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* <p> | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package org.drools.benchmarks.dmn.feel.infixexecutors; | ||
|
||
import org.kie.dmn.feel.lang.EvaluationContext; | ||
import org.kie.dmn.feel.lang.ast.infixexecutors.AddExecutor; | ||
import org.kie.dmn.feel.lang.impl.EvaluationContextImpl; | ||
import org.kie.dmn.feel.util.ClassLoaderUtil; | ||
import org.openjdk.jmh.annotations.*; | ||
|
||
import java.util.concurrent.TimeUnit; | ||
|
||
import static org.drools.benchmarks.dmn.feel.infixexecutors.FEELInfixExecutorBenchmarkUtils.getObjectArray; | ||
|
||
@Warmup(iterations = 10) | ||
@Measurement(iterations = 50) | ||
@OutputTimeUnit(TimeUnit.MILLISECONDS) | ||
@Fork(1) | ||
@State(org.openjdk.jmh.annotations.Scope.Thread) | ||
public class FEELAddExecutorBenchmark { | ||
|
||
private AddExecutor executor; | ||
private EvaluationContext ctx; | ||
|
||
private Object[] values; | ||
|
||
@Param({"String String", "Duration Duration", "OffsetDateTime Duration", "int int"}) | ||
private String argsType; | ||
|
||
|
||
@Setup | ||
public void setup() { | ||
executor = AddExecutor.instance(); | ||
ctx = new EvaluationContextImpl(ClassLoaderUtil.findDefaultClassLoader(), null); | ||
values = getObjectArray(argsType); | ||
} | ||
|
||
@Benchmark | ||
public Object evaluate() { | ||
return executor.evaluate(values[0], values[1], ctx); | ||
} | ||
} |
58 changes: 58 additions & 0 deletions
58
...src/main/java/org/drools/benchmarks/dmn/feel/infixexecutors/FEELAndExecutorBenchmark.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/** | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* <p> | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* <p> | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package org.drools.benchmarks.dmn.feel.infixexecutors; | ||
|
||
import org.kie.dmn.feel.lang.EvaluationContext; | ||
import org.kie.dmn.feel.lang.ast.infixexecutors.AndExecutor; | ||
import org.kie.dmn.feel.lang.impl.EvaluationContextImpl; | ||
import org.kie.dmn.feel.util.ClassLoaderUtil; | ||
import org.openjdk.jmh.annotations.*; | ||
|
||
import java.util.concurrent.TimeUnit; | ||
|
||
import static org.drools.benchmarks.dmn.feel.infixexecutors.FEELInfixExecutorBenchmarkUtils.getBooleanArray; | ||
|
||
@Warmup(iterations = 10) | ||
@Measurement(iterations = 50) | ||
@OutputTimeUnit(TimeUnit.MILLISECONDS) | ||
@Fork(1) | ||
@State(Scope.Thread) | ||
public class FEELAndExecutorBenchmark { | ||
|
||
private AndExecutor executor; | ||
private EvaluationContext ctx; | ||
|
||
private Object[] values; | ||
|
||
@Param({"true true", "true false", "false true", "false false"}) | ||
private String args; | ||
|
||
|
||
@Setup | ||
public void setup() { | ||
executor = AndExecutor.instance(); | ||
ctx = new EvaluationContextImpl(ClassLoaderUtil.findDefaultClassLoader(), null); | ||
values = getBooleanArray(args); | ||
} | ||
|
||
@Benchmark | ||
public Object evaluate() { | ||
return executor.evaluate(values[0], values[1], ctx); | ||
} | ||
} |
58 changes: 58 additions & 0 deletions
58
...src/main/java/org/drools/benchmarks/dmn/feel/infixexecutors/FEELDivExecutorBenchmark.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/** | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* <p> | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* <p> | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package org.drools.benchmarks.dmn.feel.infixexecutors; | ||
|
||
import org.kie.dmn.feel.lang.EvaluationContext; | ||
import org.kie.dmn.feel.lang.ast.infixexecutors.DivExecutor; | ||
import org.kie.dmn.feel.lang.impl.EvaluationContextImpl; | ||
import org.kie.dmn.feel.util.ClassLoaderUtil; | ||
import org.openjdk.jmh.annotations.*; | ||
|
||
import java.util.concurrent.TimeUnit; | ||
|
||
import static org.drools.benchmarks.dmn.feel.infixexecutors.FEELInfixExecutorBenchmarkUtils.getObjectArray; | ||
|
||
@Warmup(iterations = 10) | ||
@Measurement(iterations = 50) | ||
@OutputTimeUnit(TimeUnit.MILLISECONDS) | ||
@Fork(1) | ||
@State(Scope.Thread) | ||
public class FEELDivExecutorBenchmark { | ||
|
||
private DivExecutor executor; | ||
private EvaluationContext ctx; | ||
|
||
private Object[] values; | ||
|
||
@Param({"Duration int", "Duration Duration", "ChronoPeriod int", "ChronoPeriod ChronoPeriod"}) | ||
private String args; | ||
|
||
|
||
@Setup | ||
public void setup() { | ||
executor = DivExecutor.instance(); | ||
ctx = new EvaluationContextImpl(ClassLoaderUtil.findDefaultClassLoader(), null); | ||
values = getObjectArray(args); | ||
} | ||
|
||
@Benchmark | ||
public Object evaluate() { | ||
return executor.evaluate(values[0], values[1], ctx); | ||
} | ||
} |
58 changes: 58 additions & 0 deletions
58
.../src/main/java/org/drools/benchmarks/dmn/feel/infixexecutors/FEELEqExecutorBenchmark.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/** | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* <p> | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* <p> | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package org.drools.benchmarks.dmn.feel.infixexecutors; | ||
|
||
import org.kie.dmn.feel.lang.EvaluationContext; | ||
import org.kie.dmn.feel.lang.ast.infixexecutors.EqExecutor; | ||
import org.kie.dmn.feel.lang.impl.EvaluationContextImpl; | ||
import org.kie.dmn.feel.util.ClassLoaderUtil; | ||
import org.openjdk.jmh.annotations.*; | ||
|
||
import java.util.concurrent.TimeUnit; | ||
|
||
import static org.drools.benchmarks.dmn.feel.infixexecutors.FEELInfixExecutorBenchmarkUtils.getBooleanArray; | ||
|
||
@Warmup(iterations = 10) | ||
@Measurement(iterations = 50) | ||
@OutputTimeUnit(TimeUnit.MILLISECONDS) | ||
@Fork(1) | ||
@State(Scope.Thread) | ||
public class FEELEqExecutorBenchmark { | ||
|
||
private EqExecutor executor; | ||
private EvaluationContext ctx; | ||
|
||
private Object[] values; | ||
|
||
@Param({"Duration int", "Duration Duration", "ChronoPeriod int", "ChronoPeriod ChronoPeriod"}) | ||
private String args; | ||
|
||
|
||
@Setup | ||
public void setup() { | ||
executor = EqExecutor.instance(); | ||
ctx = new EvaluationContextImpl(ClassLoaderUtil.findDefaultClassLoader(), null); | ||
values = getBooleanArray(args); | ||
} | ||
|
||
@Benchmark | ||
public Object evaluate() { | ||
return executor.evaluate(values[0], values[1], ctx); | ||
} | ||
} |
58 changes: 58 additions & 0 deletions
58
.../src/main/java/org/drools/benchmarks/dmn/feel/infixexecutors/FEELGtExecutorBenchmark.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/** | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* <p> | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* <p> | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package org.drools.benchmarks.dmn.feel.infixexecutors; | ||
|
||
import org.kie.dmn.feel.lang.EvaluationContext; | ||
import org.kie.dmn.feel.lang.ast.infixexecutors.GtExecutor; | ||
import org.kie.dmn.feel.lang.impl.EvaluationContextImpl; | ||
import org.kie.dmn.feel.util.ClassLoaderUtil; | ||
import org.openjdk.jmh.annotations.*; | ||
|
||
import java.util.concurrent.TimeUnit; | ||
|
||
import static org.drools.benchmarks.dmn.feel.infixexecutors.FEELInfixExecutorBenchmarkUtils.getBooleanArray; | ||
|
||
@Warmup(iterations = 10) | ||
@Measurement(iterations = 50) | ||
@OutputTimeUnit(TimeUnit.MILLISECONDS) | ||
@Fork(1) | ||
@State(Scope.Thread) | ||
public class FEELGtExecutorBenchmark { | ||
|
||
private GtExecutor executor; | ||
private EvaluationContext ctx; | ||
|
||
private Object[] values; | ||
|
||
@Param({"String String", "Duration Duration", "int int", "ChronoPeriod ChronoPeriod"}) | ||
private String args; | ||
|
||
|
||
@Setup | ||
public void setup() { | ||
executor = GtExecutor.instance(); | ||
ctx = new EvaluationContextImpl(ClassLoaderUtil.findDefaultClassLoader(), null); | ||
values = getBooleanArray(args); | ||
} | ||
|
||
@Benchmark | ||
public Object evaluate() { | ||
return executor.evaluate(values[0], values[1], ctx); | ||
} | ||
} |
58 changes: 58 additions & 0 deletions
58
...src/main/java/org/drools/benchmarks/dmn/feel/infixexecutors/FEELGteExecutorBenchmark.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/** | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* <p> | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* <p> | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package org.drools.benchmarks.dmn.feel.infixexecutors; | ||
|
||
import org.kie.dmn.feel.lang.EvaluationContext; | ||
import org.kie.dmn.feel.lang.ast.infixexecutors.GteExecutor; | ||
import org.kie.dmn.feel.lang.impl.EvaluationContextImpl; | ||
import org.kie.dmn.feel.util.ClassLoaderUtil; | ||
import org.openjdk.jmh.annotations.*; | ||
|
||
import java.util.concurrent.TimeUnit; | ||
|
||
import static org.drools.benchmarks.dmn.feel.infixexecutors.FEELInfixExecutorBenchmarkUtils.getBooleanArray; | ||
|
||
@Warmup(iterations = 10) | ||
@Measurement(iterations = 50) | ||
@OutputTimeUnit(TimeUnit.MILLISECONDS) | ||
@Fork(1) | ||
@State(Scope.Thread) | ||
public class FEELGteExecutorBenchmark { | ||
|
||
private GteExecutor executor; | ||
private EvaluationContext ctx; | ||
|
||
private Object[] values; | ||
|
||
@Param({"String String", "Duration Duration", "int int", "ChronoPeriod ChronoPeriod"}) | ||
private String args; | ||
|
||
|
||
@Setup | ||
public void setup() { | ||
executor = GteExecutor.instance(); | ||
ctx = new EvaluationContextImpl(ClassLoaderUtil.findDefaultClassLoader(), null); | ||
values = getBooleanArray(args); | ||
} | ||
|
||
@Benchmark | ||
public Object evaluate() { | ||
return executor.evaluate(values[0], values[1], ctx); | ||
} | ||
} |
Oops, something went wrong.