Will Java app slow down by presence of -Xdebug or only when stepping through code?

前端 未结 3 492
再見小時候
再見小時候 2020-12-13 14:21

I realize that Java code will slow down when run in debugger.

Question is, will the code slow down simply by starting Java with these options:

Xdebug         


        
3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-13 15:02

    Performance testing results at AMD indicate that simply enabling the debug agent via the JVM commandline does cause performance degradation regardless of having a debugger connected to it, and that the degradation can be quite large depending on the workload:

    Note that we weren’t actually attaching a debugger when we were measuring performance, so we had assumed this agentlib option would be performance-neutral in this usage scenario. When we removed this option, both the CPU utilization and the performance on this workload (measured in requests handled per second) improved dramatically.

    See their report:

    http://developer.amd.com/resources/documentation-articles/articles-whitepapers/java-performance-when-debugging-is-enabled/

    Above link is dead, here's a web archive link of it: https://web.archive.org/web/20160316201129/http://developer.amd.com/resources/documentation-articles/articles-whitepapers/java-performance-when-debugging-is-enabled/

提交回复
热议问题