java 获取文件名长度,Java-性能问题;变量名和文件名长度

java 获取文件名长度,Java-性能问题;变量名和文件名长度Welljustsome butithinksom Ifiusevariab fastertoproc Example Strings willbebetter

java 获取文件名长度,Java-性能问题;变量名和文件名长度

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

解决方案

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.

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/178079.html原文链接:https://javaforall.net

(0)
上一篇 2026年3月26日 下午6:04
下一篇 2026年3月26日 下午6:04


相关推荐

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号