what's a good way to quickly bench competing imple...
# getting-started
d
what's a good way to quickly bench competing implementations of a function? is there something robust but as simple as running each function in a loop + system.getCurrentMillis(), and then doing it a few times to warm up the jvm?
n
there’s a dedicated framework for that on the JVM it’s called JMH http://openjdk.java.net/projects/code-tools/jmh/
a
You can also use the inbuilt measureTimeMillis() function to execute the block & return the time taken if you just want something a bit simpler. https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.system/measure-time-millis.html