gnodet-bot commented on code in PR #28651:
URL: https://github.com/apache/camel/pull/28651#discussion_r4408742963


##########
core/camel-base/src/main/java/org/apache/camel/impl/converter/CoreTypeConverterRegistry.java:
##########
@@ -72,6 +73,11 @@ public <T> T convertTo(Class<T> type, Exchange exchange, 
Object value) throws Ty
     // Why 256: as of Camel 4, we have about 230 type converters. Therefore, 
set the capacity to a few more to provide
     // space for others added during runtime
     private final Map<TypeConvertible<?, ?>, TypeConverter> converters = new 
ConcurrentHashMap<>(256);
+    // the results of lookup (MISS_CONVERTER when none was found), as 
resolving a type converter that is not in the
+    // converters map scans all of them, which the enum type converter would 
otherwise do for every conversion
+    private final Map<TypeConvertible<?, ?>, TypeConverter> lookups = new 
ConcurrentHashMap<>();

Review Comment:
   💡 **Nit:** The `converters` map above documents its initial capacity (`256`) 
with a reasoning comment. It's worth adding a brief note here on why `lookups` 
uses the default capacity — e.g. that it starts empty and grows lazily as 
lookups are resolved, so no pre-sizing is needed (or that it's bounded by the 
converter set size).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to