Java Singleton vs static - is there a real performance benefit?

前端 未结 7 2033
抹茶落季
抹茶落季 2021-02-04 06:46

I am merging a CVS branch and one of the larger changes is the replacement wherever it occurs of a Singleton pattern with abstract classes that have a static initialisation bloc

7条回答
  •  温柔的废话
    2021-02-04 07:01

    Write some code to measure the performance. The answer is going to be dependent on the JVM(Sun's JDK might perform differently than JRockit) and the VM flags your application uses.

提交回复
热议问题