Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java - Performance Questions; variable names and file name length

Well just some questions about performance, but i think some of the questions are logical: - If i use variables with short names will be better/faster to process? Example: "String s", will be better than "String superphrase". - About the file names, if the file name is short will be faster to access it? Example: (almost the same) filename.txt or f.txt.

Thanks to all guys, i really like to make my software as better as i can :)

like image 481
Goty Metal Avatar asked Dec 08 '22 17:12

Goty Metal


1 Answers

If i use variables with short names will be better/faster to process?

No. Variable names might not even be in your resulting bytecode. In the end of the day variables are mapped to registers/stack operands. Variable name is irrelevant. It's only for human beings. And they tend to prefer superPhrase over s.

if the file name is short will be faster to access it

No. Files, just like variables, are referenced using special identifiers (e.g. inodes). File name is only needed when opening/locating a file. And it's several orders of magnitude faster compared to actual file access. This applies equally to Java applications and other OS processes.

like image 195
Tomasz Nurkiewicz Avatar answered Dec 11 '22 05:12

Tomasz Nurkiewicz