My Oracle Support Banner

Performance of Short Critical Native Calls Is Degraded in JDK 18 (Doc ID 2922893.1)

Last updated on JANUARY 08, 2024

Applies to:

Java SE JDK and JRE - Version 18 and later
Information in this document applies to any platform.


With JDK versions 18, 19, and 20, very short critical native calls, such as clock_gettime(CLOCK_REALTIME) are approximately 23% slower as compared to JDK 17 and older versions.

The issue can be confirmed with the timers benchmark, by replacing the calls to intrinsified System.nanoTime() with something like the following:


Effective with JDK 18, the JEP 419 Foreign Function & Memory API (Second Incubator) was implemented as a replacement for JNI. As part of that work, CriticalJNINatives (-XX:+CriticalJNINatives) functionality was removed. Since CriticalJNINatives is internal functionality and not intended for general use in Java applications, it is expected that very few applications use it, and therefore, very few would be affected by this issue. Only applications that rely on CriticalJNINatives in JDK 17 or older versions to perform very short (nanoseconds) native calls may be affected by this change. 


To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!

In this Document

My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.