absurdfarce commented on code in PR #1988:
URL: 
https://github.com/apache/cassandra-java-driver/pull/1988#discussion_r2067372268


##########
core/src/main/java/com/datastax/oss/driver/internal/core/type/codec/registry/DefaultCodecRegistry.java:
##########
@@ -159,7 +159,13 @@ public boolean equals(Object other) {
 
     @Override
     public int hashCode() {
-      return Objects.hash(cqlType, javaType, isJavaCovariant);
+      // NOTE: inlined Objects.hash for performance reasons (avoid Object[] 
allocation
+      // seen in profiler allocation traces)
+      int h1 = Objects.hashCode(cqlType);
+      int h2 = Objects.hashCode(javaType);
+      int h3 = Boolean.hashCode(isJavaCovariant);
+
+      return ((31 + h1) * 31 + h2) * 31 + h3;

Review Comment:
   @tatu-at-datastax I think I'd argue for the following:
   
   ```java
       public int hashCode() {
         // NOTE: inlined Objects.hash for performance reasons (avoid Object[] 
allocation
         // seen in profiler allocation traces)
         return ((31 + Objects.hashCode(cqlType)) * 31 + 
Objects.hashCode(javaType)) * 31
             + Boolean.hashCode(isJavaCovariant);
       }
   ```
   
   It's your suggestion above + formatting changes based on Coveo.
   
   Does that work for you?



-- 
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: pr-unsubscr...@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org
For additional commands, e-mail: pr-h...@cassandra.apache.org

Reply via email to