Reputation: 5
I have a problem. I'm implementing the DPLL algorithm (which I've already finished). Now I'm calculating the running time by the standard function java api.
System.currentTimeMillis();
The problem is that I have to provide the test results to my problem, but compared to all the sources that I found on the internet, my algorithm has run times considerably better. Now either I've found the best implementation of the algorithm ever (That rule it out), or the function returns a wrong time.
The time unit of the function is milliseconds (ms)? Thank you all.
Upvotes: 0
Views: 199
Reputation: 15706
The accuracy of System.currentTimeMillis()
is rather bad (values hop in steps of dozends of milliseconds).
For benchmarking or precise timeing, better use System.nanoTime()
instead, which does (other than currentTimeMillis) not represent a date/time, but rather a time offset (in nanoseconds, 10^-9 sec).
Upvotes: 2