Are there good methods in Java for runspeed testing?

timeit module has helped me a lot in Python for comparing different pieces of code in runspeed, I thought Java would likely have equivalents, can you suggest me any? Also equivalents from other programming languages would be useful for later need.

1/2/2020 5:34:00 PM

Seb TheS

3 Answers

New Answer


I am not sure if this article helps you: https://dzone.com/articles/how-we-do-performance-testing-easily-efficiently-a


And here is an article from stack overflow: https://stackoverflow.com/questions/447739/java-performance-testing


Less robust but simple solution, if you are only interested in execution time: use System.nanoTime() before / after the execution and print or log the difference.