From 331c8ea47c6212e24a390c0b6311596d2331239a Mon Sep 17 00:00:00 2001 From: Sergei Lebedev Date: Mon, 27 Jun 2016 15:00:12 +0300 Subject: [PATCH] Moved benchmarks to '.viktor' subpackage --- .../bio/{jni => viktor}/ExpBenchmark.java | 3 +-- .../bio/{jni => viktor}/Expm1Benchmark.java | 3 +-- .../jetbrains/bio/{jni => viktor}/Internal.java | 2 +- .../bio/{jni => viktor}/Log1pBenchmark.java | 3 +-- .../bio/{jni => viktor}/LogAddExpBenchmark.java | 5 ++--- .../bio/{jni => viktor}/LogBenchmark.java | 3 +-- .../bio/{jni => viktor}/LogSumExpBenchmark.java | 3 +-- .../jetbrains/bio/{jni => viktor}/SDBenchmark.java | 4 +--- .../bio/{jni => viktor}/SumBenchmark.java | 5 +---- .../bio/{jni => viktor}/WeightedSumBenchmark.java | 5 +---- .../org/jetbrains/bio/viktor/NativeSpeedups.kt | 14 ++++++-------- 11 files changed, 17 insertions(+), 33 deletions(-) rename src/jmh/java/org/jetbrains/bio/{jni => viktor}/ExpBenchmark.java (95%) rename src/jmh/java/org/jetbrains/bio/{jni => viktor}/Expm1Benchmark.java (95%) rename src/jmh/java/org/jetbrains/bio/{jni => viktor}/Internal.java (93%) rename src/jmh/java/org/jetbrains/bio/{jni => viktor}/Log1pBenchmark.java (95%) rename src/jmh/java/org/jetbrains/bio/{jni => viktor}/LogAddExpBenchmark.java (94%) rename src/jmh/java/org/jetbrains/bio/{jni => viktor}/LogBenchmark.java (95%) rename src/jmh/java/org/jetbrains/bio/{jni => viktor}/LogSumExpBenchmark.java (96%) rename src/jmh/java/org/jetbrains/bio/{jni => viktor}/SDBenchmark.java (88%) rename src/jmh/java/org/jetbrains/bio/{jni => viktor}/SumBenchmark.java (84%) rename src/jmh/java/org/jetbrains/bio/{jni => viktor}/WeightedSumBenchmark.java (88%) diff --git a/src/jmh/java/org/jetbrains/bio/jni/ExpBenchmark.java b/src/jmh/java/org/jetbrains/bio/viktor/ExpBenchmark.java similarity index 95% rename from src/jmh/java/org/jetbrains/bio/jni/ExpBenchmark.java rename to src/jmh/java/org/jetbrains/bio/viktor/ExpBenchmark.java index 9ac2d87..a5a5f40 100644 --- a/src/jmh/java/org/jetbrains/bio/jni/ExpBenchmark.java +++ b/src/jmh/java/org/jetbrains/bio/viktor/ExpBenchmark.java @@ -1,8 +1,7 @@ -package org.jetbrains.bio.jni; +package org.jetbrains.bio.viktor; import org.apache.commons.math3.util.FastMath; import org.apache.commons.math3.util.Precision; -import org.jetbrains.bio.viktor.NativeSpeedups; import org.openjdk.jmh.annotations.*; import org.openjdk.jmh.infra.Blackhole; diff --git a/src/jmh/java/org/jetbrains/bio/jni/Expm1Benchmark.java b/src/jmh/java/org/jetbrains/bio/viktor/Expm1Benchmark.java similarity index 95% rename from src/jmh/java/org/jetbrains/bio/jni/Expm1Benchmark.java rename to src/jmh/java/org/jetbrains/bio/viktor/Expm1Benchmark.java index 510746c..93554c1 100644 --- a/src/jmh/java/org/jetbrains/bio/jni/Expm1Benchmark.java +++ b/src/jmh/java/org/jetbrains/bio/viktor/Expm1Benchmark.java @@ -1,8 +1,7 @@ -package org.jetbrains.bio.jni; +package org.jetbrains.bio.viktor; import org.apache.commons.math3.util.FastMath; import org.apache.commons.math3.util.Precision; -import org.jetbrains.bio.viktor.NativeSpeedups; import org.openjdk.jmh.annotations.*; import org.openjdk.jmh.infra.Blackhole; diff --git a/src/jmh/java/org/jetbrains/bio/jni/Internal.java b/src/jmh/java/org/jetbrains/bio/viktor/Internal.java similarity index 93% rename from src/jmh/java/org/jetbrains/bio/jni/Internal.java rename to src/jmh/java/org/jetbrains/bio/viktor/Internal.java index bd4c29d..fd86653 100644 --- a/src/jmh/java/org/jetbrains/bio/jni/Internal.java +++ b/src/jmh/java/org/jetbrains/bio/viktor/Internal.java @@ -1,4 +1,4 @@ -package org.jetbrains.bio.jni; +package org.jetbrains.bio.viktor; import org.apache.commons.math3.random.RandomDataGenerator; diff --git a/src/jmh/java/org/jetbrains/bio/jni/Log1pBenchmark.java b/src/jmh/java/org/jetbrains/bio/viktor/Log1pBenchmark.java similarity index 95% rename from src/jmh/java/org/jetbrains/bio/jni/Log1pBenchmark.java rename to src/jmh/java/org/jetbrains/bio/viktor/Log1pBenchmark.java index c9d7688..3cfc365 100644 --- a/src/jmh/java/org/jetbrains/bio/jni/Log1pBenchmark.java +++ b/src/jmh/java/org/jetbrains/bio/viktor/Log1pBenchmark.java @@ -1,8 +1,7 @@ -package org.jetbrains.bio.jni; +package org.jetbrains.bio.viktor; import org.apache.commons.math3.util.FastMath; import org.apache.commons.math3.util.Precision; -import org.jetbrains.bio.viktor.NativeSpeedups; import org.openjdk.jmh.annotations.*; import org.openjdk.jmh.infra.Blackhole; diff --git a/src/jmh/java/org/jetbrains/bio/jni/LogAddExpBenchmark.java b/src/jmh/java/org/jetbrains/bio/viktor/LogAddExpBenchmark.java similarity index 94% rename from src/jmh/java/org/jetbrains/bio/jni/LogAddExpBenchmark.java rename to src/jmh/java/org/jetbrains/bio/viktor/LogAddExpBenchmark.java index 0d2d8aa..0f0a28a 100644 --- a/src/jmh/java/org/jetbrains/bio/jni/LogAddExpBenchmark.java +++ b/src/jmh/java/org/jetbrains/bio/viktor/LogAddExpBenchmark.java @@ -1,15 +1,14 @@ -package org.jetbrains.bio.jni; +package org.jetbrains.bio.viktor; import org.apache.commons.math3.util.FastMath; import org.apache.commons.math3.util.Precision; -import org.jetbrains.bio.viktor.NativeSpeedups; import org.openjdk.jmh.annotations.*; import org.openjdk.jmh.infra.Blackhole; import java.util.concurrent.TimeUnit; @BenchmarkMode(Mode.Throughput) -@OutputTimeUnit(TimeUnit.SECONDS) +@OutputTimeUnit(TimeUnit.MILLISECONDS) @State(Scope.Benchmark) @Warmup(iterations = 10) @Measurement(iterations = 10) diff --git a/src/jmh/java/org/jetbrains/bio/jni/LogBenchmark.java b/src/jmh/java/org/jetbrains/bio/viktor/LogBenchmark.java similarity index 95% rename from src/jmh/java/org/jetbrains/bio/jni/LogBenchmark.java rename to src/jmh/java/org/jetbrains/bio/viktor/LogBenchmark.java index 54626dd..9b6b0db 100644 --- a/src/jmh/java/org/jetbrains/bio/jni/LogBenchmark.java +++ b/src/jmh/java/org/jetbrains/bio/viktor/LogBenchmark.java @@ -1,7 +1,6 @@ -package org.jetbrains.bio.jni; +package org.jetbrains.bio.viktor; import org.apache.commons.math3.util.Precision; -import org.jetbrains.bio.viktor.NativeSpeedups; import org.openjdk.jmh.annotations.*; import org.openjdk.jmh.infra.Blackhole; diff --git a/src/jmh/java/org/jetbrains/bio/jni/LogSumExpBenchmark.java b/src/jmh/java/org/jetbrains/bio/viktor/LogSumExpBenchmark.java similarity index 96% rename from src/jmh/java/org/jetbrains/bio/jni/LogSumExpBenchmark.java rename to src/jmh/java/org/jetbrains/bio/viktor/LogSumExpBenchmark.java index 7a7000a..868797d 100644 --- a/src/jmh/java/org/jetbrains/bio/jni/LogSumExpBenchmark.java +++ b/src/jmh/java/org/jetbrains/bio/viktor/LogSumExpBenchmark.java @@ -1,9 +1,8 @@ -package org.jetbrains.bio.jni; +package org.jetbrains.bio.viktor; import org.apache.commons.math3.random.RandomDataGenerator; import org.apache.commons.math3.stat.StatUtils; import org.apache.commons.math3.util.FastMath; -import org.jetbrains.bio.viktor.NativeSpeedups; import org.openjdk.jmh.annotations.*; import org.openjdk.jmh.infra.Blackhole; diff --git a/src/jmh/java/org/jetbrains/bio/jni/SDBenchmark.java b/src/jmh/java/org/jetbrains/bio/viktor/SDBenchmark.java similarity index 88% rename from src/jmh/java/org/jetbrains/bio/jni/SDBenchmark.java rename to src/jmh/java/org/jetbrains/bio/viktor/SDBenchmark.java index 51e9d56..629d60d 100644 --- a/src/jmh/java/org/jetbrains/bio/jni/SDBenchmark.java +++ b/src/jmh/java/org/jetbrains/bio/viktor/SDBenchmark.java @@ -1,7 +1,5 @@ -package org.jetbrains.bio.jni; +package org.jetbrains.bio.viktor; -import org.jetbrains.bio.viktor.NativeSpeedups; -import org.jetbrains.bio.viktor.StridedVectorKt; import org.openjdk.jmh.annotations.*; import java.util.Random; diff --git a/src/jmh/java/org/jetbrains/bio/jni/SumBenchmark.java b/src/jmh/java/org/jetbrains/bio/viktor/SumBenchmark.java similarity index 84% rename from src/jmh/java/org/jetbrains/bio/jni/SumBenchmark.java rename to src/jmh/java/org/jetbrains/bio/viktor/SumBenchmark.java index 16d33cd..ea9e0d3 100644 --- a/src/jmh/java/org/jetbrains/bio/jni/SumBenchmark.java +++ b/src/jmh/java/org/jetbrains/bio/viktor/SumBenchmark.java @@ -1,8 +1,5 @@ -package org.jetbrains.bio.jni; +package org.jetbrains.bio.viktor; -import org.jetbrains.bio.viktor.BalancedSumKt; -import org.jetbrains.bio.viktor.NativeSpeedups; -import org.jetbrains.bio.viktor.StridedVectorKt; import org.openjdk.jmh.annotations.*; import java.util.Random; diff --git a/src/jmh/java/org/jetbrains/bio/jni/WeightedSumBenchmark.java b/src/jmh/java/org/jetbrains/bio/viktor/WeightedSumBenchmark.java similarity index 88% rename from src/jmh/java/org/jetbrains/bio/jni/WeightedSumBenchmark.java rename to src/jmh/java/org/jetbrains/bio/viktor/WeightedSumBenchmark.java index 508ee55..f46a16e 100644 --- a/src/jmh/java/org/jetbrains/bio/jni/WeightedSumBenchmark.java +++ b/src/jmh/java/org/jetbrains/bio/viktor/WeightedSumBenchmark.java @@ -1,8 +1,5 @@ -package org.jetbrains.bio.jni; +package org.jetbrains.bio.viktor; -import org.jetbrains.bio.viktor.BalancedSumKt; -import org.jetbrains.bio.viktor.NativeSpeedups; -import org.jetbrains.bio.viktor.StridedVectorKt; import org.openjdk.jmh.annotations.*; import java.util.Random; diff --git a/src/main/kotlin/org/jetbrains/bio/viktor/NativeSpeedups.kt b/src/main/kotlin/org/jetbrains/bio/viktor/NativeSpeedups.kt index f83ae3a..d539056 100644 --- a/src/main/kotlin/org/jetbrains/bio/viktor/NativeSpeedups.kt +++ b/src/main/kotlin/org/jetbrains/bio/viktor/NativeSpeedups.kt @@ -57,14 +57,12 @@ object NativeSpeedups { external fun unsafeLogSumExp(src: DoubleArray, srcOffset: Int, length: Int): Double - external fun unsafeLogAddExp( - src1: DoubleArray, srcOffset1: Int, - src2: DoubleArray, srcOffset2: Int, - dst: DoubleArray, dstOffset: Int, length: Int) - - external fun unsafeLogRescale( - src: DoubleArray, srcOffset: Int, - dst: DoubleArray, dstOffset: Int, length: Int) + external fun unsafeLogAddExp(src1: DoubleArray, srcOffset1: Int, + src2: DoubleArray, srcOffset2: Int, + dst: DoubleArray, dstOffset: Int, length: Int) + + external fun unsafeLogRescale(src: DoubleArray, srcOffset: Int, + dst: DoubleArray, dstOffset: Int, length: Int) external fun unsafeDot(src1: DoubleArray, srcOffset1: Int, src2: DoubleArray, srcOffset2: Int, length: Int): Double