Are there any tools available the can help benchmark some code in Kotlin?
I can use something similar to the approaches suggested here: http://www.ibm.com/developerworks
Here is a simple micro-benchmarking tool in Kotlin: https://gist.github.com/olegcherr/b62a09aba1bff643a049
Usage is simple:
simpleMeasureTest {
// your code for the benchmark
}
Also you can configure testing, for example:
simpleMeasureTest(ITERATIONS = 1000, TEST_COUNT = 10, WARM_COUNT = 2) {
// your code for the benchmark
}
After you run this code go into the console. The output will be looking like this:
I/System.out: [TimeTest] -> go
I/System.out: [TimeTest] Warming 1 of 2
I/System.out: [TimeTest] Warming 2 of 2
I/System.out: [TimeTest] 770ms
I/System.out: [TimeTest] 784ms
I/System.out: [TimeTest] 788ms
I/System.out: [TimeTest] 881ms
I/System.out: [TimeTest] 802ms
I/System.out: [TimeTest] 794ms
I/System.out: [TimeTest] 789ms
I/System.out: [TimeTest] 786ms
I/System.out: [TimeTest] 750ms
I/System.out: [TimeTest] 762ms
I/System.out: [TimeTest] -> average=790ms / median=788ms
To make your life easier, create a new console output filter. Here is my filter in Android Studio: