为什么Java代码在调试器中放慢速度? [英] Why does Java code slow down in debugger?

查看:239
本文介绍了为什么Java代码在调试器中放慢速度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一些CPU密集型程序在运行调试器时会变得非常慢。为什么是这样?



目前我只是使用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屋!

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