[concurrency-interest] Why not "weakNanoTime" for jdk9?
aph at redhat.com
Fri Mar 6 15:14:31 EST 2015
On 03/06/2015 07:35 PM, Martin Buchholz wrote:
> 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.
> Some users have already created such a private nanoTime.
for an example of an interval timer with sub-nanosecond resolution and
about 30-nanosecond latency.
It'd be nice to be able to do something close to that in pure Java.
I'm not at all sure how Aleksey managed to get 30ns latency from
System.nanoTime(). Maybe the implementation has changed since I
More information about the Concurrency-interest