From 1d1937405d013e09478ec6843d67cb22efef5934 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Fri, 16 Apr 2021 10:05:51 +0300 Subject: [PATCH] BigIntBenchmarks. Rollback to gradle 6.8.3 because incompatibility with benchmarks --- .../kscience/kmath/benchmarks/BigIntBenchmark.kt | 12 ++++++++---- gradle/wrapper/gradle-wrapper.properties | 2 +- .../kotlin/kaceince/kmath/real/GridTest.kt | 2 ++ .../kmath/histogram/MultivariateHistogramTest.kt | 2 +- kmath-viktor/api/kmath-viktor.api | 16 +--------------- settings.gradle.kts | 2 +- 6 files changed, 14 insertions(+), 22 deletions(-) diff --git a/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/BigIntBenchmark.kt b/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/BigIntBenchmark.kt index 543d51bee..6c0af40be 100644 --- a/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/BigIntBenchmark.kt +++ b/examples/src/benchmarks/kotlin/space/kscience/kmath/benchmarks/BigIntBenchmark.kt @@ -10,23 +10,27 @@ import space.kscience.kmath.operations.invoke @State(Scope.Benchmark) internal class BigIntBenchmark { + + val kmNumber = BigIntField.number(Int.MAX_VALUE) + val jvmNumber = JBigIntegerField.number(Int.MAX_VALUE) + @Benchmark fun kmAdd(blackhole: Blackhole) = BigIntField{ - blackhole.consume(one + number(Int.MAX_VALUE)) + blackhole.consume(kmNumber + kmNumber + kmNumber) } @Benchmark fun jvmAdd(blackhole: Blackhole) = JBigIntegerField{ - blackhole.consume(one + number(Int.MAX_VALUE)) + blackhole.consume(jvmNumber + jvmNumber+ jvmNumber) } @Benchmark fun kmMultiply(blackhole: Blackhole) = BigIntField{ - blackhole.consume(number(Int.MAX_VALUE)* number(Int.MAX_VALUE)) + blackhole.consume(kmNumber*kmNumber*kmNumber) } @Benchmark fun jvmMultiply(blackhole: Blackhole) = JBigIntegerField{ - blackhole.consume(number(Int.MAX_VALUE)* number(Int.MAX_VALUE)) + blackhole.consume(jvmNumber*jvmNumber*jvmNumber) } } \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index f371643ee..442d9132e 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/kmath-for-real/src/commonTest/kotlin/kaceince/kmath/real/GridTest.kt b/kmath-for-real/src/commonTest/kotlin/kaceince/kmath/real/GridTest.kt index a7c4d30e2..560372952 100644 --- a/kmath-for-real/src/commonTest/kotlin/kaceince/kmath/real/GridTest.kt +++ b/kmath-for-real/src/commonTest/kotlin/kaceince/kmath/real/GridTest.kt @@ -1,5 +1,6 @@ package kaceince.kmath.real +import space.kscience.kmath.misc.UnstableKMathAPI import space.kscience.kmath.real.DoubleVector import space.kscience.kmath.real.minus import space.kscience.kmath.real.norm @@ -8,6 +9,7 @@ import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertTrue +@UnstableKMathAPI class GridTest { @Test fun testStepGrid() { diff --git a/kmath-histograms/src/commonTest/kotlin/space/kscience/kmath/histogram/MultivariateHistogramTest.kt b/kmath-histograms/src/commonTest/kotlin/space/kscience/kmath/histogram/MultivariateHistogramTest.kt index b4a30e2d2..70efffd25 100644 --- a/kmath-histograms/src/commonTest/kotlin/space/kscience/kmath/histogram/MultivariateHistogramTest.kt +++ b/kmath-histograms/src/commonTest/kotlin/space/kscience/kmath/histogram/MultivariateHistogramTest.kt @@ -71,7 +71,7 @@ internal class MultivariateHistogramTest { assertTrue { res.bins.count() >= histogram1.bins.count() } - assertEquals(0.0, res.bins.sumByDouble { it.value.toDouble() }) + assertEquals(0.0, res.bins.sumOf { it.value.toDouble() }) } } } \ No newline at end of file diff --git a/kmath-viktor/api/kmath-viktor.api b/kmath-viktor/api/kmath-viktor.api index bcfb49e61..87ff6d712 100644 --- a/kmath-viktor/api/kmath-viktor.api +++ b/kmath-viktor/api/kmath-viktor.api @@ -1,27 +1,13 @@ public final class space/kscience/kmath/viktor/ViktorBuffer : space/kscience/kmath/structures/MutableBuffer { - public static final synthetic fun box-impl (Lorg/jetbrains/bio/viktor/F64FlatArray;)Lspace/kscience/kmath/viktor/ViktorBuffer; - public static fun constructor-impl (Lorg/jetbrains/bio/viktor/F64FlatArray;)Lorg/jetbrains/bio/viktor/F64FlatArray; + public fun (Lorg/jetbrains/bio/viktor/F64FlatArray;)V public fun copy ()Lspace/kscience/kmath/structures/MutableBuffer; - public static fun copy-impl (Lorg/jetbrains/bio/viktor/F64FlatArray;)Lspace/kscience/kmath/structures/MutableBuffer; - public fun equals (Ljava/lang/Object;)Z - public static fun equals-impl (Lorg/jetbrains/bio/viktor/F64FlatArray;Ljava/lang/Object;)Z - public static final fun equals-impl0 (Lorg/jetbrains/bio/viktor/F64FlatArray;Lorg/jetbrains/bio/viktor/F64FlatArray;)Z public fun get (I)Ljava/lang/Double; public synthetic fun get (I)Ljava/lang/Object; - public static fun get-impl (Lorg/jetbrains/bio/viktor/F64FlatArray;I)Ljava/lang/Double; public final fun getFlatArray ()Lorg/jetbrains/bio/viktor/F64FlatArray; public fun getSize ()I - public static fun getSize-impl (Lorg/jetbrains/bio/viktor/F64FlatArray;)I - public fun hashCode ()I - public static fun hashCode-impl (Lorg/jetbrains/bio/viktor/F64FlatArray;)I public fun iterator ()Ljava/util/Iterator; - public static fun iterator-impl (Lorg/jetbrains/bio/viktor/F64FlatArray;)Ljava/util/Iterator; public fun set (ID)V public synthetic fun set (ILjava/lang/Object;)V - public static fun set-impl (Lorg/jetbrains/bio/viktor/F64FlatArray;ID)V - public fun toString ()Ljava/lang/String; - public static fun toString-impl (Lorg/jetbrains/bio/viktor/F64FlatArray;)Ljava/lang/String; - public final synthetic fun unbox-impl ()Lorg/jetbrains/bio/viktor/F64FlatArray; } public final class space/kscience/kmath/viktor/ViktorFieldND : space/kscience/kmath/nd/FieldND, space/kscience/kmath/operations/ExtendedField, space/kscience/kmath/operations/NumbersAddOperations, space/kscience/kmath/operations/ScaleOperations { diff --git a/settings.gradle.kts b/settings.gradle.kts index 0f281f46c..12a0b11b9 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -39,5 +39,5 @@ include( ":kmath-ast", ":kmath-ejml", ":kmath-kotlingrad", - ":examples", + ":examples" )