This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Performance and the fly likes Program speed, and performance. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Performance
Bookmark "Program speed, and performance." Watch "Program speed, and performance." New topic

Program speed, and performance.


Joined: May 17, 2000
Posts: 13
If I use very long variable identifiers. Will this in any
way "slow" down my programs?
String aVeryVeryVeryVeryLongIdentifier =new String("very long");
Has the access modifier any impact on my programs "speed" and
-Newbie Programmer
Frank Carver

Joined: Jan 07, 1999
Posts: 6920
This is really a question more suited to the performance forum.

Read about me at ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
paul wheaton

Joined: Dec 14, 1998
Posts: 20491

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.

permaculture Wood Burning Stoves 2.0 - 4-DVD set

Joined: May 17, 2000
Posts: 13
I also think this is an excellent site!
Jack Shirazi
Ranch Hand

Joined: Oct 26, 2000
Posts: 96
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).
It is sorta covered in the JavaRanch Style Guide.
subject: Program speed, and performance.
Similar Threads
Text in different colours
Java 1.3?
Measure Time
Is there any free libraries avaialble for file splitting usiong java??
Program speed, and performance.