camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r1393477 - in /camel/trunk/camel-core/src: main/java/org/apache/camel/impl/ main/java/org/apache/camel/util/ test/java/org/apache/camel/processor/
Date Wed, 03 Oct 2012 13:32:41 GMT
Author: davsclaus
Date: Wed Oct  3 13:32:40 2012
New Revision: 1393477

URL: http://svn.apache.org/viewvc?rev=1393477&view=rev
Log:
CAMEL-5675: No need for String intern optimization. Now its faster without.

Modified:
    camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultExchange.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/impl/MDCUnitOfWork.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/util/CaseInsensitiveMap.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/processor/RoutePerformanceTest.java

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultExchange.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultExchange.java?rev=1393477&r1=1393476&r2=1393477&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultExchange.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultExchange.java Wed Oct
 3 13:32:40 2012
@@ -107,12 +107,7 @@ public final class DefaultExchange imple
     }
 
     public Object getProperty(String name) {
-        if (hasProperties()) {
-            // use intern String for properties which is Camel* properties
-            // this reduces memory allocations needed for those common properties
-            if (name.startsWith("Camel")) {
-                name = name.intern();
-            }
+        if (properties != null) {
             return properties.get(name);
         }
         return null;
@@ -164,11 +159,6 @@ public final class DefaultExchange imple
     }
 
     public void setProperty(String name, Object value) {
-        // use intern String for properties which is Camel* properties
-        // this reduces memory allocations needed for those common properties
-        if (name != null && name.startsWith("Camel")) {
-            name = name.intern();
-        }
         if (value != null) {
             // avoid the NullPointException
             getProperties().put(name, value);

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/impl/MDCUnitOfWork.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/MDCUnitOfWork.java?rev=1393477&r1=1393476&r2=1393477&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/impl/MDCUnitOfWork.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/impl/MDCUnitOfWork.java Wed Oct
 3 13:32:40 2012
@@ -198,14 +198,7 @@ public class MDCUnitOfWork extends Defau
             this.breadcrumbId = MDC.get(MDC_BREADCRUMB_ID);
             this.correlationId = MDC.get(MDC_CORRELATION_ID);
             this.camelContextId = MDC.get(MDC_CAMEL_CONTEXT_ID);
-
-            String routeId = MDC.get(MDC_ROUTE_ID);
-            if (routeId != null) {
-                // intern route id as this reduces memory allocations
-                this.routeId = routeId.intern();
-            } else {
-                this.routeId = null;
-            }
+            this.routeId = MDC.get(MDC_ROUTE_ID);
         }
 
         public void done(boolean doneSync) {

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/util/CaseInsensitiveMap.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/util/CaseInsensitiveMap.java?rev=1393477&r1=1393476&r2=1393477&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/util/CaseInsensitiveMap.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/util/CaseInsensitiveMap.java Wed
Oct  3 13:32:40 2012
@@ -78,13 +78,7 @@ public class CaseInsensitiveMap extends 
         // invalidate views as we mutate
         entrySetView = null;
         String s = assembleKey(key);
-        if (key.startsWith("Camel")) {
-            // use intern String for headers which is Camel* headers
-            // this reduces memory allocations needed for those common headers
-            originalKeys.put(s, key.intern());
-        } else {
-            originalKeys.put(s, key);
-        }
+        originalKeys.put(s, key);
         return super.put(s, value);
     }
 
@@ -96,13 +90,7 @@ public class CaseInsensitiveMap extends 
                 String key = entry.getKey();
                 Object value = entry.getValue();
                 String s = assembleKey(key);
-                if (key.startsWith("Camel")) {
-                    // use intern String for headers which is Camel* headers
-                    // this reduces memory allocations needed for those common headers
-                    originalKeys.put(s, key.intern());
-                } else {
-                    originalKeys.put(s, key);
-                }
+                originalKeys.put(s, key);
                 super.put(s, value);
             }
         }
@@ -140,13 +128,7 @@ public class CaseInsensitiveMap extends 
     }
 
     private static String assembleKey(Object key) {
-        String s = key.toString().toLowerCase(Locale.ENGLISH);
-        if (s.startsWith("camel")) {
-            // use intern String for headers which is Camel* headers
-            // this reduces memory allocations needed for those common headers
-            s = s.intern();
-        }
-        return s;
+        return key.toString().toLowerCase(Locale.ENGLISH);
     }
 
     @Override

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/RoutePerformanceTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/RoutePerformanceTest.java?rev=1393477&r1=1393476&r2=1393477&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/RoutePerformanceTest.java
(original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/RoutePerformanceTest.java
Wed Oct  3 13:32:40 2012
@@ -34,7 +34,7 @@ import org.apache.camel.util.StopWatch;
  */
 public class RoutePerformanceTest extends ContextTestSupport {
     
-    private int size = 250;
+    private int size = 1000;
     private SimpleDataSet dataSet = new SimpleDataSet(size);
     private String uri = "mock:results";
 
@@ -46,7 +46,7 @@ public class RoutePerformanceTest extend
         endpoint.expectedHeaderReceived("foo", 123);
 
         // wait 30 sec for slow servers
-        MockEndpoint.assertIsSatisfied(context, 30, TimeUnit.SECONDS);
+        MockEndpoint.assertIsSatisfied(context, 3000, TimeUnit.SECONDS);
 
         log.info("RoutePerformanceTest: Sent: " + size + " Took: " + watch.taken() + " ms");
     }



Mime
View raw message