Though naming is irrelevant if you are passing your classes through an obfuscator & optimiser, as everyone in this competition should be!
The general purpose “iload x” instruction (rather than the special case “iload_[0-3]” shortcuts ) does not take it’s parameter (the index of the local variable) from the operand stack, it takes it as a unsigned byte parameter.
Therefore, (in the normal cases) getting a local variable onto the operand stack is either a 1 byte (e.g. iload_0 ) or 2 byte ( iload 0 ) instruction.
Accessing an array element is more complex.
At best it will be a 3 byte instruction (The array is stored in 1 of the first 4 local variables, and you are explicitly accessing an array element from 0 to 5. e.g. “aload_0; iconst_0; aaload” )
Typically however it will be much more than this.
Note, in the above I used the qualifier ‘in the normal cases’.
If you have more than 256 live local variables, the compiler will begin using the ‘wide’ instruction.
This preceeds the iload instruction, making the iload instruction expect 2 bytes for the local variable index rather than just 1.
Therefore, accessing local variables beyond the 256th becomes a 4 byte instruction!
Typically the compiler will shuffle local variables around, so as to make best use of the smaller instructions.
(or is it proguard that does this? I can never remember exactly what optimisations javac performs)