Are there good methods in Java for runspeed testing? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

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.

2nd Jan 2020, 5:34 PM
Seb TheS
Seb TheS - avatar
3 Answers
+ 4
2nd Jan 2020, 7:48 PM
Denise Roßberg
Denise Roßberg - avatar
2nd Jan 2020, 7:40 PM
Denise Roßberg
Denise Roßberg - avatar
+ 3
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.
2nd Jan 2020, 7:55 PM
Tibor Santa
Tibor Santa - avatar