Saturday, 20 August 2016

performance - Fastest way to measure elapsed time in Java

Everything I've read about currentTimeMillis vs nanoTime seem to only focus on accuracy. If I'm only looking for elapsed time in milliseconds, which one of these should I use if I want the best performance?



Seems like currentTimeMillis would be the answer, since I don't need to convert the final answer from ns to ms, but that's from my application's perspective, and what goes on under the hood could make it the wrong choice, which is why I'm asking.

No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...