Java - Performance Questions; variable names and file name length

前端 未结 2 1361
执念已碎
执念已碎 2021-01-06 10:11

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: \

2条回答
  •  旧巷少年郎
    2021-01-06 10:46

    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.

提交回复
热议问题