Java Optimizations

前端 未结 5 1814
忘了有多久
忘了有多久 2021-01-24 04:38

I am wondering if there is any performance differences between

  1. String s = someObject.toString(); System.out.println(s);

    and

  2. System.out.pr

5条回答
  •  死守一世寂寞
    2021-01-24 05:21

    Compared to output to the console, I doubt that any difference in performance between the two is going to be measurable. Don't optimize before you have measured and confirmed that you have a problem.

提交回复
热议问题