import org.joda.time.LocalDate;
public class Test {
public static void main(String[] args) {
long time=System.currentTimeMillis();
new LocalDate(2000,1, 1);
System.out.println(System.currentTimeMillis()-time);
time=System.currentTimeMillis();
new LocalDate(2000,1, 1);
System.out.println(System.currentTimeMillis()-time);
}
}
新しい LocalDate の最初の呼び出しには 110 ミリ秒かかります。2 番目の呼び出しには 0 ミリ秒かかります。
まず、特定のクラスのすべての静的初期化子を実行するにはどうすればよいですか? 次に、アプリケーションが事前に参照するすべてのクラスに対してこれを行う方法はありますか?
私のアプリケーションはレイテンシーに非常に敏感です。