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

davsclaus pushed a commit to branch direct
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/direct by this push:
     new b6cd165  CAMEL-15690: camel-direct - Optimize direct producer to wire 
to consumer if possible during start or only once during processing. This 
avoids excessive synchronized locking for each processing to get the consumer - 
there can only be 1 consumer anyway.
b6cd165 is described below

commit b6cd165a5518bfca8a66706bfd06f609bfd62519
Author: Claus Ibsen <[email protected]>
AuthorDate: Thu Oct 15 18:36:15 2020 +0200

    CAMEL-15690: camel-direct - Optimize direct producer to wire to consumer if 
possible during start or only once during processing. This avoids excessive 
synchronized locking for each processing to get the consumer - there can only 
be 1 consumer anyway.
---
 .../org/apache/camel/itest/jmh/DirectConcurrentTest.java  | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git 
a/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/DirectConcurrentTest.java
 
b/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/DirectConcurrentTest.java
index ad2e156..97c1b06 100644
--- 
a/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/DirectConcurrentTest.java
+++ 
b/tests/camel-jmh/src/test/java/org/apache/camel/itest/jmh/DirectConcurrentTest.java
@@ -34,7 +34,6 @@ import org.openjdk.jmh.infra.Blackhole;
 import org.openjdk.jmh.runner.Runner;
 import org.openjdk.jmh.runner.options.Options;
 import org.openjdk.jmh.runner.options.OptionsBuilder;
-import org.openjdk.jmh.runner.options.TimeValue;
 
 /**
  * Tests a simple Camel route
@@ -48,12 +47,10 @@ public class DirectConcurrentTest {
                 // You can be more specific if you'd like to run only one 
benchmark per test.
                 .include(this.getClass().getName() + ".*")
                 // Set the following options as needed
-                .mode(Mode.All)
-                .timeUnit(TimeUnit.MICROSECONDS)
-                .warmupTime(TimeValue.seconds(5))
-                .warmupIterations(0)
-                .measurementTime(TimeValue.seconds(30))
-                .measurementIterations(1)
+                .mode(Mode.AverageTime)
+                .timeUnit(TimeUnit.MILLISECONDS)
+                .warmupIterations(1)
+                .measurementIterations(5)
                 .threads(4)
                 .forks(1)
                 .shouldFailOnError(true)
@@ -115,7 +112,9 @@ public class DirectConcurrentTest {
     @Benchmark
     public void directConcurrentTest(BenchmarkState state, Blackhole bh) {
         ProducerTemplate template = state.producer;
-        template.sendBody("direct:start", "Hello World");
+        for (int i = 0; i < 50000; i++) {
+            template.sendBody("direct:start", "Hello " + i);
+        }
     }
 
 }

Reply via email to