If I use very long variable identifiers. Will this in any way "slow" down my programs? I.E.: String aVeryVeryVeryVeryLongIdentifier =new String("very long"); Has the access modifier any impact on my programs "speed" and performance? -Newbie Programmer
When the time comes to production, a lot of folks run their code through an obfuscator making this question moot. I suppose it is possible that the name size can make a difference. But it would be up to the JVM that is running it.
Longer class & method names should have only one performance impact, which is the size they have on the .class files. The JVM should not run any slower except for the minimal extra time it takes to load a large .class file (possibly including network downloads). Variable names are different in that variable names are not retained directly in the bytecodes. Instead all variables are compiled to JVM addresses, and the length of the variable name makes no difference at all. However, the compiler is allowed to retain the variable names in the .class file in a separate variable name table, so that debuggers (and decompilers) can use the original names. By default most compilers do retain this table. Retaining the table has the same effect as noted for class/method names, i.e. a larger .class file. You can normally eliminate the variable name table using one of the compiler options, e.g. -O or -g:none (the option varies with the compiler), or you can use an optimizing recompiler that can strip out the variable name table after compilation (see the resources section at my site for a list of some tools that do this).