Javac调试开启和关闭之间是否存在性能差异? [英] Is there a performance difference between Javac debug on and off?

查看:335
本文介绍了Javac调试开启和关闭之间是否存在性能差异?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我使用Javac打开生成调试信息,那么类文件的大小就是20-25%。这对运行Java程序有任何性能影响吗?如果是的,哪些条件和多少。我希望对加载类有一点影响,因为文件较大,但这应该是最小的。

If I switch on the generating of debug info with Javac then the class files are 20-25% larger. Has this any performance effects on running the Java program? If yes on which conditions and how many. I expect a little impact on loading the classes because the files are larger but this should be minimal.

推荐答案

在任何语言中,调试信息是元信息。它本质上增加了对象文件的大小,从而增加了加载时间。在执行调试器之外的时候,这个信息实际上被完全忽视了。如 JVM规格(尽管不清楚) 调试信息存储在字节码流外。这意味着在执行时,类文件没有区别。如果你想确定,请尝试: - )。

In any language, debugging information is meta information. It by its nature increases the size of the object files, thus increasing load time. During execution outside a debugger, this information is actually completely ignored. As outlined (although not clearly) in the JVM spec the debug information is stored outside the bytecode stream. This means that at execution time there is no difference in the class file. If you want to be sure though, try it out :-).

Ps。通常调试时有关于优化的价值。 具有性能影响。

Ps. Often for debugging there is value in turning off optimization. That does have a performance impact.

这篇关于Javac调试开启和关闭之间是否存在性能差异?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆