Does Java run any code for System.out.println(...)
when I run the program in a console-less GUI? (where I don't redirect the program output to anywhere)
In fact I'd like to know if System.out.println(...)
can affect the program performance when it is run by clicking the jar file.
Consider that I print thousands of lines per minute.
The way Java deals with calls, there probably will be significant impact if you
println
something that's not a simple string.For example,
creates a StringBuilder, converts an
int
and copies a bunch of characters before it can even decide that there is nothing behindSystem.out
.