chaokunyang commented on code in PR #1892:
URL: https://github.com/apache/fury/pull/1892#discussion_r1811027555


##########
java/fury-core/src/main/java/org/apache/fury/serializer/EnumSerializer.java:
##########
@@ -40,20 +50,54 @@ public EnumSerializer(Fury fury, Class<Enum> cls) {
       Preconditions.checkArgument(enclosingClass.isEnum());
       enumConstants = enclosingClass.getEnumConstants();
     }
+
+    if (fury.getConfig().serializeEnumByName()) {
+      // as we know the size of enum is fixed, initialize the size of map with 
that value
+      int initialCapacity = (int) Math.ceil(enumConstants.length / 0.99f);
+
+      metaStringtoEnumRepresentation = new HashMap<>(initialCapacity, 0.99f);

Review Comment:
   ObjectMap is better here, and the load factor 0.5f  may be better



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to