Why not "weakNanoTime" for jdk9?

Martin Buchholz martinrb at google.com
Fri Mar 6 19:35:51 UTC 2015


We all know that nanoTime has problems.  Many (most?) users of nanoTime,
especially for benchmarking or concurrent algorithms, don't really care
about the monotonicity guarantee and just want a "best-effort"
"as-efficient-as-possible" version of nanoTime.  Sure, some algorithms in
java.util.concurrent might need to change slightly to accommodate nanoTime
going backwards, but we already do this to some extent.

http://shipilev.net/blog/2014/nanotrusting-nanotime/

Some users have already created such a private nanoTime.



More information about the core-libs-dev mailing list