Discussions
Join us for complimentary one-day events around the world and step into a future fueled by AI and limitless potential. Explore new breakthroughs, sharpen your skills, and connect with experts who are shaping what’s next. Experience bold keynotes, interactive learning, and connections that span the global NetSuite community. Discover what's next at SuiteConnect Tour 2026.
Class.newInstance performance JDK11 vs JDK8
We are seeing a performance degradation on JDK11 with Class.newInstance() as compared to JDK8.
For quick check I executed below class on both JDK11 and JDK8. Execution time is ~25ms vs ~14ms in JDK11 and JDK8 resectively.
Is this a known issue or any workaround?
public class PerformanceTest {
public PerformanceTest() {
}
public static void main(String[] args) {
long l = System.currentTimeMillis();
for (int i = 0; i < 100000; i++) {
try {
PerformanceTest.class.newInstance();
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
System.out.println("time taken = " + (System.currentTimeMillis() - l) + "ms");
}
}