Java has a nanosecond timer!
It works well too.
Quick test script:
We do empty loops of varying numbers of iterations, and use the nanotimer to test how long that takes:
for( int its = 0; its < 100; its++ ) {
long start = System.nanoTime();
for( int i = 0; i < its; i++ ) {
}
long delta = System.nanoTime() - start;
System.out.println("its " + its + ": " + delta );
}
No comments:
Post a Comment