Skip to content

Instantly share code, notes, and snippets.

@Wadeck
Created January 9, 2018 14:20
Show Gist options
  • Save Wadeck/1ffc61d83d7ee858ede4f72c3d49120e to your computer and use it in GitHub Desktop.
Save Wadeck/1ffc61d83d7ee858ede4f72c3d49120e to your computer and use it in GitHub Desktop.
@CompileStatic
class NanoStaticGroovy {
static void main(String[] args) throws Exception {
// avoid warmup problems
for (int i = 0; i < 500; i++) {
System.nanoTime()
}
final int NUM = 100000
long[] times = new long[NUM]
for (int i = 0; i < NUM; i++) {
times[i] = System.nanoTime()
}
for (int i = 0; i < NUM; i++) {
println times[i]
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment