Discussions
SuiteWorld is the largest annual gathering of the NetSuite community! It will be held in Las Vegas on October 6-9, 2025. Our customers and partners look forward to SuiteWorld every year as a place to hear the latest from NetSuite, get hands-on learning, and connect with each other. Register now!
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");
}
}