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 -Xrunjdwp:transport=dt_socket,address=5005,server=y,suspend=n
??
Or does the slowdown only happen when you connect to the “debug port” and actually step through code using an IDE?
First, to strictly answer your question – at least as stated in its title –
-Xdebugonly enables debugging support in the VM using JVMDI in JVMs prior to 5.0. So in itself, it doesn’t do much. Moreover, JVMDI is deprecated since 5.0 in favor of JVMTI:So -Xdebug doesn’t do anything anymore and the important part is:
or, starting with Java 5.0, the newer (that you should prefer as the JDWP agent in 5.0 uses the JVM TI interface to the VM rather than the older JVMDI interface):
Now, to my knowledge, just loading the jwdp agent and/or configuring the JVM to listen
for a socket connection on a given port don’t have any noticeable performance impact. But connecting a debugger does.