Micro-benchmarking
While performance testing focuses on system-level performance, micro-benchmarking is a performance measurement of a small and isolated piece of code at the function level. Micro-benchmarking is usually applicable to the following areas:
- The algorithm that sits in the core of the whole system – for example, a search algorithm for an internet search engine
- The function that’s used most frequently by end users
- The function that’s exposed as an API to external systems
- The code path that’s mission-critical and performance-sensitive
- When comparing the implementations of a function, an algorithm, or a code change
Kotlin benchmarking (https://github.com/Kotlin/kotlinx-benchmark) is the most popular tool for running benchmarks for Kotlin code. It wraps the classic Java Microbenchmark Harness (JMH) framework, and it supports Kotlin through Java Virtual Machine (JVM), JS, Native, and even Web Assembly (WASM).