Skip to content

dievsky/kotlin-math-benchmark

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Benchmarking Kotlin mathematical libraries

The goal of this project is to compare the performance of several mathematical libraries for Kotlin.

Libraries

kmath

multik

viktor

Benchmarks

We test the performance of the following operations:

  • elementwise addition and multiplication of two double arrays, both with and without an offset
  • dot product (aka scalar product) of two double arrays
  • sum of all elements of a double array
  • elementwise exponent, logarithm, expm1 and log1p of a double array

We also test the performance of the "naive" Kotlin implementations of these operations.

Running

This is a JMH project. Its intended execution mode is

mvn clean verify
java -jar target/benchmarks.jar

The usual JMH options can be added to the latter command.

Results

Caveat / Conflict of Interest

The author of this benchmark suite is also the author and maintainer of viktor, one of the libraries being tested. The results might be biased despite my best efforts to stay objective.

Environments

We ran the suite on a Lenovo ThinkPad laptop:

parameter value
CPU Intel Core i7-6820HQ
frequency 2.70GHz
architecture amd64
SIMD extension AVX
OS Ubuntu 20.04 LTS

The benchmark suite was run overnight as the only user application.

Raw Results

We tested three JVMs:

Combined Results

On the following plot, we show the performance gain (or loss) of the tested library as compared to the naïve JVM baseline (i.e. a simple loop). For instance, the value of 2 would mean that the particular library is twice as fast as the baseline.

performance gain

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages