Java - System.out effect on performance

后端 未结 5 2192
日久生厌
日久生厌 2020-12-09 05:49

I\'ve seen this question and it\'s somewhat similar. I would like to know if it really is a big factor that would affect the performance of my application. Here\'s my scenar

5条回答
  •  猫巷女王i
    2020-12-09 06:27

    System.out.println()
    

    is synchronized.

     public void println(String x) {
        synchronized (this) {
            print(x);
            newLine();
        }
    

    If multiple threads write to it, its performance will suffer.

提交回复
热议问题