You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by or...@apache.org on 2023/10/13 10:01:11 UTC

[camel] branch main updated: (chores) camel-core: avoid hitting the JVM slow path

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

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


The following commit(s) were added to refs/heads/main by this push:
     new b35b2b9815d (chores) camel-core: avoid hitting the JVM slow path
b35b2b9815d is described below

commit b35b2b9815d22f2fd358ebdb79e9146869dd6ac9
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Thu Oct 5 16:29:31 2023 +0200

    (chores) camel-core: avoid hitting the JVM slow path
    
    In most cases, the type checks will be false, which causes the JVM to hit its slow path checking the type.
    
    This already happens subsequently, so adjust it to check only for equality at first.
---
 .../java/org/apache/camel/impl/converter/CoreTypeConverterRegistry.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/core/camel-base/src/main/java/org/apache/camel/impl/converter/CoreTypeConverterRegistry.java b/core/camel-base/src/main/java/org/apache/camel/impl/converter/CoreTypeConverterRegistry.java
index d9b1a39f425..17a4a8425f1 100644
--- a/core/camel-base/src/main/java/org/apache/camel/impl/converter/CoreTypeConverterRegistry.java
+++ b/core/camel-base/src/main/java/org/apache/camel/impl/converter/CoreTypeConverterRegistry.java
@@ -107,7 +107,7 @@ public abstract class CoreTypeConverterRegistry extends ServiceSupport implement
             return null;
         }
 
-        if (type.isInstance(value)) {
+        if (type.equals(value.getClass())) {
             // same instance
             return (T) value;
         }