Hen1ng commented on code in PR #2050:
URL: https://github.com/apache/fury/pull/2050#discussion_r1948519445


##########
java/fury-core/src/main/java/org/apache/fury/Fury.java:
##########
@@ -604,6 +604,16 @@ private void writeData(MemoryBuffer buffer, ClassInfo 
classInfo, Object obj) {
       case ClassResolver.STRING_CLASS_ID:
         stringSerializer.writeJavaString(buffer, (String) obj);
         break;
+      case ClassResolver.ARRAYLIST_CLASS_ID:

Review Comment:
   i made writeData public, and use javap -c Fury.class. Obtain the following 
result
   public void writeData(org.apache.fury.memory.MemoryBuffer, 
org.apache.fury.resolver.ClassInfo, java.lang.Object);
       Code:
          0: aload_2
          1: invokevirtual #162                // Method 
org/apache/fury/resolver/ClassInfo.getClassId:()S
          4: tableswitch   { // 14 to 34
                       14: 104
                       15: 118
                       16: 132
                       17: 146
                       18: 160
                       19: 196
                       20: 210
                       21: 228
                       22: 242
                       23: 327
                       24: 327
                       25: 327
                       26: 327
                       27: 327
                       28: 327
                       29: 327
                       30: 327
                       31: 327
                       32: 327
                       33: 257
                       34: 292
                  default: 327
             }
   
   string class id is 22, arraylist classid is 33, and hashmap class id is 34, 
the result shows that JVM automatically fills the gaps before 22-33 and still 
uses the tableswitch bytecode instruction, which has a complexity of O (1)



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