I am wondering how much of a performance penalty there is if all the Java code I generated had debug information in it. If there is not much of a penalty then I could do things like get very useful information in production when needed without having to recompile.
I assume that you think about line numbers and local variable names.
Both debug additions don't add extra instructions to the byte code. So the performance should be unaffected. Line numbers and variable names are just extra tables in the class files and are ignored unless you actually debug the code.
javac compiler options:
-g
Generate all debugging information, including local variables.
By default, only line number and source file information is generated.
-g:none
Do not generate any debugging information.
-g:{keyword list}
Generate only some kinds of debugging information, specified by
a comma separated list of keywords. Valid keywords are:
source
Source file debugging information
lines
Line number debugging information
vars
Local variable debugging information
I would never debug on any production environment. If you have a problem on prod you need to try and recreate it on a dev or test environment, this is where you might debug. I guess that you've already turned all your logging up to it's highest granularity and this has failed to reveal the problem?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With