Calculating and presenting benchmarks

Python pytest has a great plugin benchmark (pytest-benchmark · PyPI) which enables a very easy setting up of a comparative benchmark of functions where the framework runs each function many times for many different data input and outputs a table of results to the console.

Does Kotlin (or Java) have anything at all similar?

JMH - Java Microbench Harness probably what you are looking for.

Here is a good intro to the concepts. Although it is a bit old, it explains the basics and gives some examples.

Additionally, Duncan McGregor gave a talk at KotlinConf 2017 on benchmarking Kotlin language features. He has several blog posts on the subject as well, here is Part 1 (the rest are linked at the end of that page).

Hope that helps!

1 Like