This is an automated email from the ASF dual-hosted git repository.

sergeykamov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git


The following commit(s) were added to refs/heads/master by this push:
     new c179cdf  JMH based performance tests improved.
c179cdf is described below

commit c179cdf94736efd6e0f5dfea4c00a61e80d63dbe
Author: Sergey Kamov <[email protected]>
AuthorDate: Thu Mar 24 15:34:45 2022 +0300

    JMH based performance tests improved.
---
 nlpcraft/src/test/resources/log4j2.xml             |  2 +-
 .../nlpcraft/nlp/benchmark/client/2022-03-24.json  | 38 +++++++++++-----------
 .../nlp/benchmark/client/NCClientBenchmark.java    | 11 +++----
 3 files changed, 24 insertions(+), 27 deletions(-)

diff --git a/nlpcraft/src/test/resources/log4j2.xml 
b/nlpcraft/src/test/resources/log4j2.xml
index cfe76d9..cdf681c 100644
--- a/nlpcraft/src/test/resources/log4j2.xml
+++ b/nlpcraft/src/test/resources/log4j2.xml
@@ -36,7 +36,7 @@
             <AppenderRef ref="stdout"/>
             <AppenderRef ref="stderr"/>
         </Root>
-        <Logger name="org.apache.nlpcraft" level="${sys:TEST_LOG_LEVEL:-INFO}" 
additivity="false">
+        <Logger name="org.apache.nlpcraft" level="INFO" additivity="false">
             <AppenderRef ref="stdout"/>
             <AppenderRef ref="stderr"/>
         </Logger>
diff --git 
a/nlpcraft/src/test/scala/org/apache/nlpcraft/nlp/benchmark/client/2022-03-24.json
 
b/nlpcraft/src/test/scala/org/apache/nlpcraft/nlp/benchmark/client/2022-03-24.json
index d32d76a..361c2ff 100644
--- 
a/nlpcraft/src/test/scala/org/apache/nlpcraft/nlp/benchmark/client/2022-03-24.json
+++ 
b/nlpcraft/src/test/scala/org/apache/nlpcraft/nlp/benchmark/client/2022-03-24.json
@@ -20,32 +20,32 @@
         "measurementTime" : "5 s",
         "measurementBatchSize" : 1,
         "primaryMetric" : {
-            "score" : 33.79294654474718,
-            "scoreError" : 2.6623621700704545,
+            "score" : 35.172879664478664,
+            "scoreError" : 6.889296148120174,
             "scoreConfidence" : [
-                31.130584374676726,
-                36.45530871481763
+                28.28358351635849,
+                42.06217581259884
             ],
             "scorePercentiles" : {
-                "0.0" : 32.856635424836604,
-                "50.0" : 33.618395845637586,
-                "90.0" : 34.6278818137931,
-                "95.0" : 34.6278818137931,
-                "99.0" : 34.6278818137931,
-                "99.9" : 34.6278818137931,
-                "99.99" : 34.6278818137931,
-                "99.999" : 34.6278818137931,
-                "99.9999" : 34.6278818137931,
-                "100.0" : 34.6278818137931
+                "0.0" : 33.55694421333333,
+                "50.0" : 34.22256824489796,
+                "90.0" : 37.96897621212121,
+                "95.0" : 37.96897621212121,
+                "99.0" : 37.96897621212121,
+                "99.9" : 37.96897621212121,
+                "99.99" : 37.96897621212121,
+                "99.999" : 37.96897621212121,
+                "99.9999" : 37.96897621212121,
+                "100.0" : 37.96897621212121
             },
             "scoreUnit" : "ms/op",
             "rawData" : [
                 [
-                    32.856635424836604,
-                    34.6278818137931,
-                    33.618395845637586,
-                    33.56359287919463,
-                    34.29822676027397
+                    34.22256824489796,
+                    33.55694421333333,
+                    34.20795181632653,
+                    35.907957835714285,
+                    37.96897621212121
                 ]
             ]
         },
diff --git 
a/nlpcraft/src/test/scala/org/apache/nlpcraft/nlp/benchmark/client/NCClientBenchmark.java
 
b/nlpcraft/src/test/scala/org/apache/nlpcraft/nlp/benchmark/client/NCClientBenchmark.java
index dc4c6b8..fe6474d 100644
--- 
a/nlpcraft/src/test/scala/org/apache/nlpcraft/nlp/benchmark/client/NCClientBenchmark.java
+++ 
b/nlpcraft/src/test/scala/org/apache/nlpcraft/nlp/benchmark/client/NCClientBenchmark.java
@@ -17,6 +17,8 @@
 
 package org.apache.nlpcraft.nlp.benchmark.client;
 
+import org.apache.logging.log4j.core.config.Configurator;
+import org.apache.logging.log4j.core.config.NullConfiguration;
 import org.apache.nlpcraft.NCEntity;
 import org.apache.nlpcraft.NCIntent;
 import org.apache.nlpcraft.NCIntentTerm;
@@ -24,14 +26,11 @@ import org.apache.nlpcraft.NCModel;
 import org.apache.nlpcraft.NCModelAdapter;
 import org.apache.nlpcraft.NCModelClient;
 import org.apache.nlpcraft.NCModelConfig;
-import org.apache.nlpcraft.NCModelPipeline;
 import org.apache.nlpcraft.NCModelPipelineBuilder;
 import org.apache.nlpcraft.NCRequest;
 import org.apache.nlpcraft.NCResult;
 import org.apache.nlpcraft.NCResultType;
-import org.apache.nlpcraft.nlp.util.NCTestModelAdapter;
 import org.apache.nlpcraft.nlp.util.NCTestRequest;
-import org.apache.nlpcraft.nlp.util.NCTestUtils;
 import org.openjdk.jmh.annotations.Benchmark;
 import org.openjdk.jmh.annotations.BenchmarkMode;
 import org.openjdk.jmh.annotations.Fork;
@@ -49,7 +48,6 @@ import org.openjdk.jmh.runner.Runner;
 import org.openjdk.jmh.runner.RunnerException;
 import org.openjdk.jmh.runner.options.OptionsBuilder;
 
-import java.time.Instant;
 import java.time.LocalDate;
 import java.time.format.DateTimeFormatter;
 import java.util.List;
@@ -65,10 +63,9 @@ import java.util.concurrent.TimeUnit;
 @Warmup(iterations = 5, time = 10)
 @Measurement(iterations = 5, time = 5)
 public class NCClientBenchmark {
-    // It overrides 'org.apache.nlpcraft' log level value in test scope 
log4j.xml property file.
-    // Should be here to be loaded before logger initialized.
+    // It disables logging. Should be here to be applied before logger 
initialized.
     static {
-        System.setProperty("TEST_LOG_LEVEL", "ERROR");
+        Configurator.initialize(new NullConfiguration());
     }
 
     @State(Scope.Thread)

Reply via email to