This is an automated email from the ASF dual-hosted git repository.
tzimanyi pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-kie-benchmarks.git
The following commit(s) were added to refs/heads/main by this push:
new 2e7480a2 [incubator-kie-issues#1890] Begin benchmarking efesto (#290)
2e7480a2 is described below
commit 2e7480a208af054d5db73da80bded1819de91705
Author: Gabriele Cardosi <[email protected]>
AuthorDate: Tue May 20 10:39:01 2025 +0200
[incubator-kie-issues#1890] Begin benchmarking efesto (#290)
---
.../benchmarks/efesto/mocks/MockEfestoOutput.java | 36 ++++++++++++++
.../EfestoOutputDeserializerBenchmark.java | 56 +++++++++++++++++++++
.../EfestoOutputSerializerBenchmark.java | 57 ++++++++++++++++++++++
3 files changed, 149 insertions(+)
diff --git
a/drools-benchmarks-parent/drools-benchmarks/src/main/java/org/drools/benchmarks/efesto/mocks/MockEfestoOutput.java
b/drools-benchmarks-parent/drools-benchmarks/src/main/java/org/drools/benchmarks/efesto/mocks/MockEfestoOutput.java
new file mode 100644
index 00000000..951a2c34
--- /dev/null
+++
b/drools-benchmarks-parent/drools-benchmarks/src/main/java/org/drools/benchmarks/efesto/mocks/MockEfestoOutput.java
@@ -0,0 +1,36 @@
+/*
+ * 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
+ *
+ * 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.efesto.mocks;
+
+import org.kie.efesto.common.api.identifiers.LocalUri;
+import org.kie.efesto.common.api.identifiers.ModelLocalUriId;
+import org.kie.efesto.runtimemanager.api.model.AbstractEfestoOutput;
+
+public class MockEfestoOutput extends AbstractEfestoOutput<String> {
+
+ public MockEfestoOutput() {
+ super(new ModelLocalUriId(LocalUri.parse("/mock/" +
MockEfestoOutput.class.getCanonicalName().replace('.',
+
'/'))),
+ "MockEfestoOutput");
+ }
+
+ public MockEfestoOutput(ModelLocalUriId modelLocalUriId, String
outputData) {
+ super(modelLocalUriId, outputData);
+ }
+}
diff --git
a/drools-benchmarks-parent/drools-benchmarks/src/main/java/org/drools/benchmarks/efesto/serialization/EfestoOutputDeserializerBenchmark.java
b/drools-benchmarks-parent/drools-benchmarks/src/main/java/org/drools/benchmarks/efesto/serialization/EfestoOutputDeserializerBenchmark.java
new file mode 100644
index 00000000..e4a25b1a
--- /dev/null
+++
b/drools-benchmarks-parent/drools-benchmarks/src/main/java/org/drools/benchmarks/efesto/serialization/EfestoOutputDeserializerBenchmark.java
@@ -0,0 +1,56 @@
+/*
+ * 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
+ *
+ * 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.efesto.serialization;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.drools.benchmarks.common.AbstractBenchmark;
+import org.drools.benchmarks.common.ProviderException;
+import org.kie.efesto.common.core.utils.JSONUtils;
+import org.kie.efesto.runtimemanager.api.model.EfestoOutput;
+import org.openjdk.jmh.annotations.Benchmark;
+import org.openjdk.jmh.annotations.BenchmarkMode;
+import org.openjdk.jmh.annotations.Measurement;
+import org.openjdk.jmh.annotations.Mode;
+import org.openjdk.jmh.annotations.Setup;
+import org.openjdk.jmh.annotations.Warmup;
+
+import java.util.concurrent.TimeUnit;
+
+@BenchmarkMode(Mode.AverageTime)
+@Warmup(iterations = 40, time = 2, timeUnit = TimeUnit.SECONDS)
+@Measurement(iterations = 15, time = 2, timeUnit = TimeUnit.SECONDS)
+public class EfestoOutputDeserializerBenchmark extends AbstractBenchmark {
+
+ private static final String toDeserialize =
"{\"modelLocalUriId\":{\"model\":\"mock\",\"basePath\":\"/org/drools/benchmarks/efesto/mocks/MockEfestoOutput\",\"fullPath\":\"/mock/org/drools/benchmarks/efesto/mocks/MockEfestoOutput\"},\"outputData\":\"MockEfestoOutput\",\"kind\":\"org.drools.benchmarks.efesto.mocks.MockEfestoOutput\"}";
+
+ private ObjectMapper objectMapper;
+
+ @Setup
+ @Override
+ public void setup() throws ProviderException {
+ objectMapper = JSONUtils.getObjectMapper();
+ }
+
+ @Benchmark
+ public EfestoOutput testDeserialize() throws JsonProcessingException {
+ return objectMapper.readValue(toDeserialize, EfestoOutput.class);
+ }
+}
diff --git
a/drools-benchmarks-parent/drools-benchmarks/src/main/java/org/drools/benchmarks/efesto/serialization/EfestoOutputSerializerBenchmark.java
b/drools-benchmarks-parent/drools-benchmarks/src/main/java/org/drools/benchmarks/efesto/serialization/EfestoOutputSerializerBenchmark.java
new file mode 100644
index 00000000..14a150e1
--- /dev/null
+++
b/drools-benchmarks-parent/drools-benchmarks/src/main/java/org/drools/benchmarks/efesto/serialization/EfestoOutputSerializerBenchmark.java
@@ -0,0 +1,57 @@
+/*
+ * 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
+ *
+ * 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.efesto.serialization;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.drools.benchmarks.common.AbstractBenchmark;
+import org.drools.benchmarks.common.ProviderException;
+import org.drools.benchmarks.efesto.mocks.MockEfestoOutput;
+import org.kie.efesto.common.core.utils.JSONUtils;
+import org.kie.efesto.runtimemanager.api.model.EfestoOutput;
+import org.openjdk.jmh.annotations.Benchmark;
+import org.openjdk.jmh.annotations.BenchmarkMode;
+import org.openjdk.jmh.annotations.Measurement;
+import org.openjdk.jmh.annotations.Mode;
+import org.openjdk.jmh.annotations.Setup;
+import org.openjdk.jmh.annotations.Warmup;
+
+import java.util.concurrent.TimeUnit;
+
+@BenchmarkMode(Mode.AverageTime)
+@Warmup(iterations = 40, time = 2, timeUnit = TimeUnit.SECONDS)
+@Measurement(iterations = 15, time = 2, timeUnit = TimeUnit.SECONDS)
+public class EfestoOutputSerializerBenchmark extends AbstractBenchmark {
+
+ private EfestoOutput toSerialize = new MockEfestoOutput();
+
+ private ObjectMapper objectMapper;
+
+ @Setup
+ @Override
+ public void setup() throws ProviderException {
+ objectMapper = JSONUtils.getObjectMapper();
+ }
+
+ @Benchmark
+ public String testSerialize() throws JsonProcessingException {
+ return objectMapper.writeValueAsString(toSerialize);
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]