为什么Java代码在调试器中放慢速度? [英] Why does Java code slow down in debugger?
问题描述
目前我只是使用IntelliJ来逐步运行在JBoss中的代码。当我启动JBoss时,我使用这些选项:
set JAVA_OPTS = -Xms512m -Xmx1024m -XX:MaxPermSize = 256m -Xdebug - Xrunjdwp:transport = dt_socket,address = 5005,server = y,suspend = n%JAVA_OPTS%
是有办法加快执行力度?或者加快某些方法执行,我不需要逐步执行?
更新:似乎我没有跨越/进入CPU密集程序(即:只需运行直到在例程之后设置断点),那么执行时间就好像不在调试器中。
运行调试器时,某些CPU密集型程序会变得非常慢。为什么是这样?
因为启用调试时,JITter不会优化代码(通常不是) / p>
Some CPU intensive routines get dramatically slower when run through a debugger. Why is this?
Currently I'm just using IntelliJ to step through code running in JBoss. When I start JBoss, I use these options:
set JAVA_OPTS=-Xms512m -Xmx1024m -XX:MaxPermSize=256m -Xdebug -Xrunjdwp:transport=dt_socket,address=5005,server=y,suspend=n %JAVA_OPTS%
Is there a way to speed up the execution? Or to speed up certain method executions that I don't need to step through?
Update: Seems if I don't step over/into the CPU intensive routines (ie: Just run til a breakpoint set right after the routine), then the execution time is as if not in a debugger.
Some CPU intensive routines get dramatically slower when run through a debugger. Why is this?
Because the JITter won't optimize code as much (often, not at all) when debugging is enabled.
这篇关于为什么Java代码在调试器中放慢速度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!