Change constants for getting more stable benchmarks. (#2631)
This commit is contained in:
@@ -1,8 +1,8 @@
|
|||||||
org.jetbrains.kotlin.native.home=../dist
|
org.jetbrains.kotlin.native.home=../dist
|
||||||
org.jetbrains.kotlin.native.jvmArgs=-Xmx6G
|
org.jetbrains.kotlin.native.jvmArgs=-Xmx6G
|
||||||
jvmWarmup = 10000
|
jvmWarmup = 10000
|
||||||
nativeWarmup = 10
|
nativeWarmup = 20
|
||||||
attempts = 10
|
attempts = 60
|
||||||
jvmBenchResults = jvmBenchResults.json
|
jvmBenchResults = jvmBenchResults.json
|
||||||
nativeBenchResults = nativeBenchResults.json
|
nativeBenchResults = nativeBenchResults.json
|
||||||
nativeTextReport = nativeReport.txt
|
nativeTextReport = nativeReport.txt
|
||||||
@@ -14,4 +14,4 @@ analyzerToolDirectory = tools/benchmarksAnalyzer/build/bin
|
|||||||
outputReport = ../report/report.html
|
outputReport = ../report/report.html
|
||||||
bintrayUrl = https://api.bintray.com/content/lepilkinaelena
|
bintrayUrl = https://api.bintray.com/content/lepilkinaelena
|
||||||
bintrayRepo = KotlinNativePerformance
|
bintrayRepo = KotlinNativePerformance
|
||||||
bintrayPackage = jsonReports
|
bintrayPackage = jsonReports
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import octoTest
|
|||||||
import kotlin.math.sqrt
|
import kotlin.math.sqrt
|
||||||
import org.jetbrains.report.BenchmarkResult
|
import org.jetbrains.report.BenchmarkResult
|
||||||
|
|
||||||
val BENCHMARK_SIZE = 100
|
const val BENCHMARK_SIZE = 10000
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------//
|
//-----------------------------------------------------------------------------//
|
||||||
|
|
||||||
@@ -455,4 +455,4 @@ class Launcher(val numWarmIterations: Int, val numberOfAttempts: Int) {
|
|||||||
fun runOctoTest() {
|
fun runOctoTest() {
|
||||||
launch(::octoTest, "OctoTest")
|
launch(::octoTest, "OctoTest")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ fun main(args: Array<String>) {
|
|||||||
|
|
||||||
val options = listOf(
|
val options = listOf(
|
||||||
OptionDescriptor(ArgType.String(), "output", "o", "Output file"),
|
OptionDescriptor(ArgType.String(), "output", "o", "Output file"),
|
||||||
OptionDescriptor(ArgType.Double(), "eps", "e", "Meaningful performance changes", "0.5"),
|
OptionDescriptor(ArgType.Double(), "eps", "e", "Meaningful performance changes", "1.0"),
|
||||||
OptionDescriptor(ArgType.Boolean(), "short", "s", "Show short version of report", "false"),
|
OptionDescriptor(ArgType.Boolean(), "short", "s", "Show short version of report", "false"),
|
||||||
OptionDescriptor(ArgType.Choice(listOf("text", "html", "teamcity", "statistics")),
|
OptionDescriptor(ArgType.Choice(listOf("text", "html", "teamcity", "statistics")),
|
||||||
"renders", "r", "Renders for showing information", "text", isMultiple = true),
|
"renders", "r", "Renders for showing information", "text", isMultiple = true),
|
||||||
|
|||||||
@@ -71,10 +71,11 @@ data class MeanVarianceBenchmark(val meanBenchmark: BenchmarkResult, val varianc
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun geometricMean(values: List<Double>) = values.map { it.pow(1.0 / values.size) }.reduce { a, b -> a * b }
|
fun geometricMean(values: List<Double>, totalNumber: Int? = null) =
|
||||||
|
values.map { it.pow(1.0 / (totalNumber ?: values.size)) }.reduce { a, b -> a * b }
|
||||||
|
|
||||||
fun computeMeanVariance(samples: List<Double>): MeanVariance {
|
fun computeMeanVariance(samples: List<Double>): MeanVariance {
|
||||||
val zStar = 1.96 // Critical point for 90% confidence of normal distribution.
|
val zStar = 1.67 // Critical point for 90% confidence of normal distribution.
|
||||||
val mean = samples.sum() / samples.size
|
val mean = samples.sum() / samples.size
|
||||||
val variance = samples.indices.sumByDouble { (samples[it] - mean) * (samples[it] - mean) } / samples.size
|
val variance = samples.indices.sumByDouble { (samples[it] - mean) * (samples[it] - mean) } / samples.size
|
||||||
val confidenceInterval = sqrt(variance / samples.size) * zStar
|
val confidenceInterval = sqrt(variance / samples.size) * zStar
|
||||||
|
|||||||
+2
-2
@@ -142,12 +142,12 @@ class SummaryBenchmarksReport (val currentReport: BenchmarksReport,
|
|||||||
return 0.0
|
return 0.0
|
||||||
var percentsList = bucket.values.map { it.first.mean }
|
var percentsList = bucket.values.map { it.first.mean }
|
||||||
return if (percentsList.first() > 0.0) {
|
return if (percentsList.first() > 0.0) {
|
||||||
geometricMean(percentsList)
|
geometricMean(percentsList, benchmarksNumber)
|
||||||
} else {
|
} else {
|
||||||
// Geometric mean can be counted on positive numbers.
|
// Geometric mean can be counted on positive numbers.
|
||||||
val precision = abs(getMaximumChange(bucket)) + 1
|
val precision = abs(getMaximumChange(bucket)) + 1
|
||||||
percentsList = percentsList.map { it + precision }
|
percentsList = percentsList.map { it + precision }
|
||||||
geometricMean(percentsList) - precision
|
geometricMean(percentsList, benchmarksNumber) - precision
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ class AnalyzerTests {
|
|||||||
val numbers = listOf(10.1, 10.2, 10.3)
|
val numbers = listOf(10.1, 10.2, 10.3)
|
||||||
val value = computeMeanVariance(numbers)
|
val value = computeMeanVariance(numbers)
|
||||||
val expectedMean = 10.2
|
val expectedMean = 10.2
|
||||||
val expectedVariance = 0.092395
|
val expectedVariance = 0.12539360253
|
||||||
assertTrue(abs(value.mean - expectedMean) < eps)
|
assertTrue(abs(value.mean - expectedMean) < eps)
|
||||||
assertTrue(abs(value.variance - expectedVariance) < eps)
|
assertTrue(abs(value.variance - expectedVariance) < eps)
|
||||||
}
|
}
|
||||||
@@ -76,4 +76,4 @@ class AnalyzerTests {
|
|||||||
assertTrue(abs(ratio.mean - expectedMean) < eps)
|
assertTrue(abs(ratio.mean - expectedMean) < eps)
|
||||||
assertTrue(abs(ratio.variance - expectedVariance) < eps)
|
assertTrue(abs(ratio.variance - expectedVariance) < eps)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user