Closed kimholan closed 5 years ago
Is there any particular reason to box the Bytes for the for-loop? Seems a bit unnecessary, although the JVM will probably inline this.
public int decodeAndCheck(java.io.InputStream) throws java.io.IOException; Code: 0: aload_0 1: getfield #2 // Field tagBytes:[B 4: astore_2 5: aload_2 6: arraylength 7: istore_3 8: iconst_0 9: istore 4 11: iload 4 13: iload_3 14: if_icmpge 78 17: aload_2 18: iload 4 20: baload 21: invokestatic #18 // Method java/lang/Byte.valueOf:(B)Ljava/lang/Byte; 24: astore 5 26: aload_1 27: invokevirtual #11 // Method java/io/InputStream.read:()I
vs
public int decodeAndCheck(java.io.InputStream) throws java.io.IOException; Code: 0: aload_0 1: getfield #2 // Field tagBytes:[B 4: astore_2 5: aload_2 6: arraylength 7: istore_3 8: iconst_0 9: istore 4 11: iload 4 13: iload_3 14: if_icmpge 72 17: aload_2 18: iload 4 20: baload 21: istore 5 23: aload_1 24: invokevirtual #11 // Method java/io/InputStream.read:()I
yes of course that is completely unnecessary. thanks
Is there any particular reason to box the Bytes for the for-loop? Seems a bit unnecessary, although the JVM will probably inline this.
vs