mirror of
https://gitee.com/dromara/liteFlow.git
synced 2026-05-14 04:02:09 +08:00
增加benchmark的工程测试
This commit is contained in:
24
liteflow-benchmark/liteflow-benchmark-script-groovy/pom.xml
Normal file
24
liteflow-benchmark/liteflow-benchmark-script-groovy/pom.xml
Normal file
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>liteflow-benchmark</artifactId>
|
||||
<groupId>com.yomahub</groupId>
|
||||
<version>${revision}</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>liteflow-benchmark-script-groovy</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.yomahub</groupId>
|
||||
<artifactId>liteflow-script-groovy</artifactId>
|
||||
<version>${revision}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.yomahub.liteflow.benchmark;
|
||||
|
||||
import cn.hutool.core.io.resource.ResourceUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.yomahub.liteflow.builder.LiteFlowNodeBuilder;
|
||||
import com.yomahub.liteflow.builder.el.LiteFlowChainELBuilder;
|
||||
import com.yomahub.liteflow.core.FlowExecutor;
|
||||
import com.yomahub.liteflow.flow.FlowBus;
|
||||
import org.openjdk.jmh.annotations.*;
|
||||
import org.openjdk.jmh.runner.Runner;
|
||||
import org.openjdk.jmh.runner.RunnerException;
|
||||
import org.openjdk.jmh.runner.options.Options;
|
||||
import org.openjdk.jmh.runner.options.OptionsBuilder;
|
||||
import org.openjdk.jmh.runner.options.TimeValue;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@State(Scope.Benchmark)
|
||||
@EnableAutoConfiguration
|
||||
@PropertySource(value = "classpath:application.properties")
|
||||
@ComponentScan("com.yomahub.liteflow.benchmark.cmp")
|
||||
public class ScriptGroovyBenchmark {
|
||||
|
||||
private ConfigurableApplicationContext applicationContext;
|
||||
|
||||
private FlowExecutor flowExecutor;
|
||||
|
||||
@Setup
|
||||
public void setup() {
|
||||
applicationContext = SpringApplication.run(ScriptGroovyBenchmark.class);
|
||||
flowExecutor = applicationContext.getBean(FlowExecutor.class);
|
||||
}
|
||||
|
||||
@TearDown
|
||||
public void tearDown() {
|
||||
applicationContext.close();
|
||||
}
|
||||
|
||||
//普通执行
|
||||
@Benchmark
|
||||
public void test1(){
|
||||
flowExecutor.execute2Resp("chain1");
|
||||
}
|
||||
|
||||
//LF动态创建组件和规则,并执行
|
||||
@Benchmark
|
||||
public void test2(){
|
||||
String scriptContent = ResourceUtil.readUtf8Str("classpath:script.groovy");
|
||||
LiteFlowNodeBuilder.createScriptNode().setId("ds").setScript(scriptContent).build();
|
||||
|
||||
if(!FlowBus.containChain("chain2")){
|
||||
LiteFlowChainELBuilder.createChain().setChainId("chain2").setEL("THEN(ds)").build();
|
||||
}
|
||||
flowExecutor.execute2Resp("chain2");
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) throws RunnerException {
|
||||
Options opt = new OptionsBuilder()
|
||||
.include(ScriptGroovyBenchmark.class.getSimpleName())
|
||||
.mode(Mode.Throughput)
|
||||
.warmupIterations(1)//预热次数
|
||||
.measurementIterations(3)//执行次数
|
||||
.measurementTime(new TimeValue(10, TimeUnit.SECONDS))//每次执行多少时间
|
||||
.threads(100)//多少个线程
|
||||
.forks(1)//多少个进程
|
||||
.timeUnit(TimeUnit.SECONDS)
|
||||
.build();
|
||||
new Runner(opt).run();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* <p>Title: liteflow</p>
|
||||
* <p>Description: 轻量级的组件式流程框架</p>
|
||||
* @author Bryan.Zhang
|
||||
* @email weenyc31@163.com
|
||||
* @Date 2020/4/1
|
||||
*/
|
||||
package com.yomahub.liteflow.benchmark.cmp;
|
||||
|
||||
import com.yomahub.liteflow.annotation.LiteflowComponent;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
|
||||
@LiteflowComponent("a")
|
||||
public class ACmp extends NodeComponent {
|
||||
|
||||
@Override
|
||||
public void process() {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* <p>Title: liteflow</p>
|
||||
* <p>Description: 轻量级的组件式流程框架</p>
|
||||
* @author Bryan.Zhang
|
||||
* @email weenyc31@163.com
|
||||
* @Date 2020/4/1
|
||||
*/
|
||||
package com.yomahub.liteflow.benchmark.cmp;
|
||||
|
||||
import com.yomahub.liteflow.annotation.LiteflowComponent;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
|
||||
@LiteflowComponent("b")
|
||||
public class BCmp extends NodeComponent {
|
||||
|
||||
@Override
|
||||
public void process() {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* <p>Title: liteflow</p>
|
||||
* <p>Description: 轻量级的组件式流程框架</p>
|
||||
* @author Bryan.Zhang
|
||||
* @email weenyc31@163.com
|
||||
* @Date 2020/4/1
|
||||
*/
|
||||
package com.yomahub.liteflow.benchmark.cmp;
|
||||
|
||||
import com.yomahub.liteflow.annotation.LiteflowComponent;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
|
||||
@LiteflowComponent("c")
|
||||
public class CCmp extends NodeComponent {
|
||||
|
||||
@Override
|
||||
public void process() {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.yomahub.liteflow.benchmark.cmp;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
||||
@Component
|
||||
public class TestDomain {
|
||||
|
||||
public String sayHello(String name){
|
||||
return "hello," + name;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
liteflow.rule-source=flow.xml
|
||||
liteflow.print-execution-log=false
|
||||
liteflow.script-setting.javax-is-cache=false
|
||||
@@ -0,0 +1,55 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE flow PUBLIC "liteflow" "liteflow.dtd">
|
||||
<flow>
|
||||
<nodes>
|
||||
<node id="s1" name="普通脚本1" type="script" language="groovy">
|
||||
<![CDATA[
|
||||
import cn.hutool.core.collection.ListUtil
|
||||
import cn.hutool.core.date.DateUtil
|
||||
|
||||
import java.util.function.Consumer
|
||||
import java.util.function.Function
|
||||
import java.util.stream.Collectors
|
||||
|
||||
def date = DateUtil.parse("2022-10-17 13:31:43")
|
||||
defaultContext.setData("demoDate", date)
|
||||
|
||||
List<String> list = ListUtil.toList("a", "b", "c")
|
||||
|
||||
List<String> resultList = list.stream().map(s -> "hello," + s).collect(Collectors.toList())
|
||||
|
||||
defaultContext.setData("resultList", resultList)
|
||||
|
||||
class Student {
|
||||
int studentID
|
||||
String studentName
|
||||
}
|
||||
|
||||
Student student = new Student()
|
||||
student.studentID = 100301
|
||||
student.studentName = "张三"
|
||||
defaultContext.setData("student", student)
|
||||
|
||||
def a = 3
|
||||
def b = 2
|
||||
defaultContext.setData("s1", a * b)
|
||||
]]>
|
||||
</node>
|
||||
|
||||
<node id="s2" name="循环脚本1" type="for_script" language="groovy">
|
||||
<![CDATA[
|
||||
return 2
|
||||
]]>
|
||||
</node>
|
||||
|
||||
<node id="s3" name="选择脚本" type="switch_script" language="groovy">
|
||||
<![CDATA[
|
||||
return "b"
|
||||
]]>
|
||||
</node>
|
||||
</nodes>
|
||||
|
||||
<chain name="chain1">
|
||||
THEN(FOR(s2).DO(THEN(a, b, c, s1)), SWITCH(s3).TO(a,b));
|
||||
</chain>
|
||||
</flow>
|
||||
@@ -0,0 +1,29 @@
|
||||
import cn.hutool.core.collection.ListUtil
|
||||
import cn.hutool.core.date.DateUtil
|
||||
|
||||
import java.util.function.Consumer
|
||||
import java.util.function.Function
|
||||
import java.util.stream.Collectors
|
||||
|
||||
def date = DateUtil.parse("2022-10-17 13:31:43")
|
||||
defaultContext.setData("demoDate", date)
|
||||
|
||||
List<String> list = ListUtil.toList("a", "b", "c")
|
||||
|
||||
List<String> resultList = list.stream().map(s -> "hello," + s).collect(Collectors.toList())
|
||||
|
||||
defaultContext.setData("resultList", resultList)
|
||||
|
||||
class Student {
|
||||
int studentID
|
||||
String studentName
|
||||
}
|
||||
|
||||
Student student = new Student()
|
||||
student.studentID = 100301
|
||||
student.studentName = "张三"
|
||||
defaultContext.setData("student", student)
|
||||
|
||||
def a = 3
|
||||
def b = 2
|
||||
defaultContext.setData("s1", a * b)
|
||||
24
liteflow-benchmark/liteflow-benchmark-script-java/pom.xml
Normal file
24
liteflow-benchmark/liteflow-benchmark-script-java/pom.xml
Normal file
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>liteflow-benchmark</artifactId>
|
||||
<groupId>com.yomahub</groupId>
|
||||
<version>${revision}</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>liteflow-benchmark-script-java</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.yomahub</groupId>
|
||||
<artifactId>liteflow-script-java</artifactId>
|
||||
<version>${revision}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.yomahub.liteflow.benchmark;
|
||||
|
||||
import cn.hutool.core.io.resource.ResourceUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.yomahub.liteflow.builder.LiteFlowNodeBuilder;
|
||||
import com.yomahub.liteflow.builder.el.LiteFlowChainELBuilder;
|
||||
import com.yomahub.liteflow.core.FlowExecutor;
|
||||
import com.yomahub.liteflow.flow.FlowBus;
|
||||
import org.openjdk.jmh.annotations.*;
|
||||
import org.openjdk.jmh.runner.Runner;
|
||||
import org.openjdk.jmh.runner.RunnerException;
|
||||
import org.openjdk.jmh.runner.options.Options;
|
||||
import org.openjdk.jmh.runner.options.OptionsBuilder;
|
||||
import org.openjdk.jmh.runner.options.TimeValue;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@State(Scope.Benchmark)
|
||||
@EnableAutoConfiguration
|
||||
@PropertySource(value = "classpath:application.properties")
|
||||
@ComponentScan("com.yomahub.liteflow.benchmark.cmp")
|
||||
public class ScriptJavaBenchmark {
|
||||
|
||||
private ConfigurableApplicationContext applicationContext;
|
||||
|
||||
private FlowExecutor flowExecutor;
|
||||
|
||||
@Setup
|
||||
public void setup() {
|
||||
applicationContext = SpringApplication.run(ScriptJavaBenchmark.class);
|
||||
flowExecutor = applicationContext.getBean(FlowExecutor.class);
|
||||
}
|
||||
|
||||
@TearDown
|
||||
public void tearDown() {
|
||||
applicationContext.close();
|
||||
}
|
||||
|
||||
//普通执行
|
||||
@Benchmark
|
||||
public void test1(){
|
||||
flowExecutor.execute2Resp("chain1");
|
||||
}
|
||||
|
||||
//LF动态创建组件和规则,并执行
|
||||
@Benchmark
|
||||
public void test2(){
|
||||
String scriptContent = ResourceUtil.readUtf8Str("classpath:javaScript.java");
|
||||
LiteFlowNodeBuilder.createScriptNode().setId("ds").setScript(scriptContent).build();
|
||||
|
||||
if(!FlowBus.containChain("chain2")){
|
||||
LiteFlowChainELBuilder.createChain().setChainId("chain2").setEL("THEN(ds)").build();
|
||||
}
|
||||
flowExecutor.execute2Resp("chain2");
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) throws RunnerException {
|
||||
Options opt = new OptionsBuilder()
|
||||
.include(ScriptJavaBenchmark.class.getSimpleName())
|
||||
.mode(Mode.Throughput)
|
||||
.warmupIterations(1)//预热次数
|
||||
.measurementIterations(3)//执行次数
|
||||
.measurementTime(new TimeValue(10, TimeUnit.SECONDS))//每次执行多少时间
|
||||
.threads(300)//多少个线程
|
||||
.forks(1)//多少个进程
|
||||
.timeUnit(TimeUnit.SECONDS)
|
||||
.build();
|
||||
new Runner(opt).run();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* <p>Title: liteflow</p>
|
||||
* <p>Description: 轻量级的组件式流程框架</p>
|
||||
* @author Bryan.Zhang
|
||||
* @email weenyc31@163.com
|
||||
* @Date 2020/4/1
|
||||
*/
|
||||
package com.yomahub.liteflow.benchmark.cmp;
|
||||
|
||||
import com.yomahub.liteflow.annotation.LiteflowComponent;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
|
||||
@LiteflowComponent("a")
|
||||
public class ACmp extends NodeComponent {
|
||||
|
||||
@Override
|
||||
public void process() {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* <p>Title: liteflow</p>
|
||||
* <p>Description: 轻量级的组件式流程框架</p>
|
||||
* @author Bryan.Zhang
|
||||
* @email weenyc31@163.com
|
||||
* @Date 2020/4/1
|
||||
*/
|
||||
package com.yomahub.liteflow.benchmark.cmp;
|
||||
|
||||
import com.yomahub.liteflow.annotation.LiteflowComponent;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
|
||||
@LiteflowComponent("b")
|
||||
public class BCmp extends NodeComponent {
|
||||
|
||||
@Override
|
||||
public void process() {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* <p>Title: liteflow</p>
|
||||
* <p>Description: 轻量级的组件式流程框架</p>
|
||||
* @author Bryan.Zhang
|
||||
* @email weenyc31@163.com
|
||||
* @Date 2020/4/1
|
||||
*/
|
||||
package com.yomahub.liteflow.benchmark.cmp;
|
||||
|
||||
import com.yomahub.liteflow.annotation.LiteflowComponent;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
|
||||
@LiteflowComponent("c")
|
||||
public class CCmp extends NodeComponent {
|
||||
|
||||
@Override
|
||||
public void process() {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* <p>Title: liteflow</p>
|
||||
* <p>Description: 轻量级的组件式流程框架</p>
|
||||
* @author Bryan.Zhang
|
||||
* @email weenyc31@163.com
|
||||
* @Date 2020/4/1
|
||||
*/
|
||||
package com.yomahub.liteflow.benchmark.cmp;
|
||||
|
||||
import com.yomahub.liteflow.annotation.LiteflowComponent;
|
||||
import com.yomahub.liteflow.core.NodeComponent;
|
||||
import com.yomahub.liteflow.slot.DefaultContext;
|
||||
|
||||
@LiteflowComponent("d")
|
||||
public class DCmp extends NodeComponent {
|
||||
|
||||
@Override
|
||||
public void process() {
|
||||
DefaultContext context = this.getFirstContextBean();
|
||||
context.setData("count", 198);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.yomahub.liteflow.benchmark.cmp;
|
||||
|
||||
public class Person {
|
||||
private String name;
|
||||
|
||||
private Integer salary;
|
||||
|
||||
public Person(String name, Integer salary) {
|
||||
this.name = name;
|
||||
this.salary = salary;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Integer getSalary() {
|
||||
return salary;
|
||||
}
|
||||
|
||||
public void setSalary(Integer salary) {
|
||||
this.salary = salary;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.yomahub.liteflow.benchmark.cmp;
|
||||
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
public class TestDomain {
|
||||
|
||||
public String sayHello(String name){
|
||||
return "hello," + name;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
List<Person> personList = ListUtil.toList(
|
||||
new Person("jack", 15000),
|
||||
new Person("tom", 13500),
|
||||
new Person("peter", 18600)
|
||||
);
|
||||
|
||||
int totalSalary = personList.stream().mapToInt(Person::getSalary).sum();
|
||||
System.out.println(totalSalary);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
liteflow.rule-source=flow.xml
|
||||
liteflow.print-execution-log=false
|
||||
liteflow.script-setting.javax-is-cache=false
|
||||
@@ -0,0 +1,60 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE flow PUBLIC "liteflow" "liteflow.dtd">
|
||||
<flow>
|
||||
<nodes>
|
||||
<node id="s1" name="普通脚本1" type="script" language="java">
|
||||
<![CDATA[
|
||||
import com.yomahub.liteflow.benchmark.cmp.TestDomain;
|
||||
import com.yomahub.liteflow.slot.DefaultContext;
|
||||
import com.yomahub.liteflow.spi.holder.ContextAwareHolder;
|
||||
import com.yomahub.liteflow.script.body.JaninoCommonScriptBody;
|
||||
import com.yomahub.liteflow.script.ScriptExecuteWrap;
|
||||
|
||||
public class Demo implements JaninoCommonScriptBody {
|
||||
public Void body(ScriptExecuteWrap wrap) {
|
||||
int v1 = 2;
|
||||
int v2 = 3;
|
||||
DefaultContext ctx = (DefaultContext) wrap.getCmp().getFirstContextBean();
|
||||
ctx.setData("s1", v1 * v2);
|
||||
|
||||
TestDomain domain = (TestDomain) ContextAwareHolder.loadContextAware().getBean(TestDomain.class);
|
||||
String str = domain.sayHello("jack");
|
||||
ctx.setData("hi", str);
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
]]>
|
||||
</node>
|
||||
|
||||
<node id="s2" name="循环脚本1" type="for_script" language="java">
|
||||
<![CDATA[
|
||||
import com.yomahub.liteflow.script.body.JaninoForScriptBody;
|
||||
import com.yomahub.liteflow.script.ScriptExecuteWrap;
|
||||
|
||||
public class Demo implements JaninoForScriptBody{
|
||||
public Integer body(ScriptExecuteWrap wrap){
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
]]>
|
||||
</node>
|
||||
|
||||
<node id="s3" name="选择脚本" type="switch_script" language="java">
|
||||
<![CDATA[
|
||||
import com.yomahub.liteflow.script.ScriptExecuteWrap;
|
||||
import com.yomahub.liteflow.script.body.JaninoSwitchScriptBody;
|
||||
|
||||
public class Demo implements JaninoSwitchScriptBody {
|
||||
public String body(ScriptExecuteWrap wrap) {
|
||||
return "b";
|
||||
}
|
||||
}
|
||||
]]>
|
||||
</node>
|
||||
</nodes>
|
||||
|
||||
<chain name="chain1">
|
||||
THEN(FOR(s2).DO(THEN(a, b, c, s1)), SWITCH(s3).TO(a,b));
|
||||
</chain>
|
||||
</flow>
|
||||
@@ -0,0 +1,20 @@
|
||||
import com.yomahub.liteflow.benchmark.cmp.TestDomain;
|
||||
import com.yomahub.liteflow.slot.DefaultContext;
|
||||
import com.yomahub.liteflow.spi.holder.ContextAwareHolder;
|
||||
import com.yomahub.liteflow.script.body.JaninoCommonScriptBody;
|
||||
import com.yomahub.liteflow.script.ScriptExecuteWrap;
|
||||
|
||||
public class Demo implements JaninoCommonScriptBody {
|
||||
public Void body(ScriptExecuteWrap wrap) {
|
||||
int v1 = 2;
|
||||
int v2 = 3;
|
||||
DefaultContext ctx = (DefaultContext) wrap.getCmp().getFirstContextBean();
|
||||
ctx.setData("s1", v1 * v2);
|
||||
|
||||
TestDomain domain = (TestDomain) ContextAwareHolder.loadContextAware().getBean(TestDomain.class);
|
||||
String str = domain.sayHello("jack");
|
||||
ctx.setData("hi", str);
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.yomahub.liteflow.benchmark;
|
||||
|
||||
import cn.hutool.core.io.resource.ResourceUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.yomahub.liteflow.builder.LiteFlowNodeBuilder;
|
||||
import com.yomahub.liteflow.builder.el.LiteFlowChainELBuilder;
|
||||
import com.yomahub.liteflow.core.FlowExecutor;
|
||||
@@ -68,7 +69,7 @@ public class ScriptJavaxBenchmark {
|
||||
.warmupIterations(1)//预热次数
|
||||
.measurementIterations(3)//执行次数
|
||||
.measurementTime(new TimeValue(10, TimeUnit.SECONDS))//每次执行多少时间
|
||||
.threads(300)//多少个线程
|
||||
.threads(100)//多少个线程
|
||||
.forks(1)//多少个进程
|
||||
.timeUnit(TimeUnit.SECONDS)
|
||||
.build();
|
||||
|
||||
@@ -44,6 +44,9 @@
|
||||
|
||||
<modules>
|
||||
<module>liteflow-benchmark-script-javax</module>
|
||||
<module>liteflow-benchmark-script-java</module>
|
||||
<module>liteflow-benchmark-script-groovy</module>
|
||||
<module>liteflow-benchmark-script-kotlin</module>
|
||||
</modules>
|
||||
|
||||
<build>
|
||||
|
||||
Reference in New Issue
Block a user