Memory and variable names
Does a integer named GameState is used faster, initalized faster or has any performance or memory disadvantage against the same variable with a shorter name, like GState?
No. There is no difference whatsoever between the two. Variable names are for you, and you only, and have no effect on the resulting code (*).
* Debug information notwithstanding.
* Debug information notwithstanding.
If we are talking about compiled code: No difference at all. Actually the name of a variable is completely dropped during compilation.
If we are talking about interpreted code: Longer names will have a slightly higher overhead (parsing the name takes longer). How much overhead beyond that depends on the design. But all in all I would say if you can use an interpreted language for your problem, then variable name length is not an issue in any case.
Precompiled code depends entirely on the implementation.
If we are talking about interpreted code: Longer names will have a slightly higher overhead (parsing the name takes longer). How much overhead beyond that depends on the design. But all in all I would say if you can use an interpreted language for your problem, then variable name length is not an issue in any case.
Precompiled code depends entirely on the implementation.
The only perfomance a shorter name might gain is Lines of Code per Day.
writting GState a hundred times in code is much faster than writting GameState, and is way faster than writting:
fhajohgsasdfasfgdfgdfhdshghfghfdghdfgas
That is usually why programmer prefer GState to GameState, cuts down on programmer''s work, as long as that programmer can remember that GState means GameState....
writting GState a hundred times in code is much faster than writting GameState, and is way faster than writting:
fhajohgsasdfasfgdfgdfhdshghfghfdghdfgas
That is usually why programmer prefer GState to GameState, cuts down on programmer''s work, as long as that programmer can remember that GState means GameState....
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement