File I / O is incredibly slow in Eclipse debug mode

I've often found Eclipse's debug mode useful when relying on print statements or logging. However, I have found that the performance of debug mode is particularly sensitive to file I / O. Downloading a file can be slower way (takes ~ 25 times), and since my workflow requires a fairly large file to download before I get to anything interesting, this is especially inconvenient for me.

Is there a sane workaround for this problem? I don't really need to debug while loading the file, so maybe there is a way to only go into debug mode at some point in the process?

Please note that unlike this question , I don't think this is an issue with the state of my workspace.

+3


source to share


2 answers


You can connect to a running app with eclipse debug functionality. You need to run the application with some parameters:

java -Xdebug -Xrunjdwp:transport=dt_socket,address=8001,server=y suspend=y -jar yourapp.jar



Then in the debug configuration select Remote Java Application using port 8001.

More details with photos here

+2


source


Maybe you are doing IO in a slow way (reading in small chunks) and debugging just amplifies that since there is overhead on every function call.

NetBeans has a way of specifying which features will appear in the profile, so I would look for a similar option in Eclipse and then tell me that it shouldn't profile anything in the namespace java.*

or any of your IO-specific code if that doesn't help ...



I also need to make sure that you read your file quickly (using buffered input streams, not using Scanner

etc.). There may be things in NIO that might help, but I'm not familiar with that.

+1


source







All Articles