Corner cases with failed code size measurement. Choice tools for buil… (#2731)
This commit is contained in:
@@ -1,8 +1,9 @@
|
|||||||
def dist = findProperty('org.jetbrains.kotlin.native.home') ?: 'dist'
|
def dist = findProperty('org.jetbrains.kotlin.native.home') ?: 'dist'
|
||||||
|
def toolExtension = System.getProperty("os.name").startsWith('Windows') ? ".bat" : ""
|
||||||
project.ext {
|
project.ext {
|
||||||
applicationName = 'HelloWorld'
|
applicationName = 'HelloWorld'
|
||||||
repeatNumber = 10
|
repeatNumber = 10
|
||||||
buildSteps = ["runKonanc": ["${project.getProjectDir()}/$dist/bin/konanc", "${project.getProjectDir()}/src/main/kotlin/main.kt", "-o",
|
buildSteps = ["runKonanc": ["${project.getProjectDir()}/$dist/bin/konanc$toolExtension", "${project.getProjectDir()}/src/main/kotlin/main.kt", "-o",
|
||||||
"${buildDir.absolutePath}/program${MPPTools.getNativeProgramExtension()}"]]
|
"${buildDir.absolutePath}/program${MPPTools.getNativeProgramExtension()}"]]
|
||||||
}
|
}
|
||||||
apply from: rootProject.file("${rootProject.rootDir}/gradle/compileBenchmark.gradle")
|
apply from: rootProject.file("${rootProject.rootDir}/gradle/compileBenchmark.gradle")
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
def dist = findProperty('org.jetbrains.kotlin.native.home') ?: 'dist'
|
def dist = findProperty('org.jetbrains.kotlin.native.home') ?: 'dist'
|
||||||
|
def toolExtension = System.getProperty("os.name").startsWith('Windows') ? ".bat" : ""
|
||||||
|
|
||||||
def linkerOpts = []
|
def linkerOpts = []
|
||||||
if (MPPTools.isMacos()) {
|
if (MPPTools.isMacos()) {
|
||||||
@@ -34,15 +35,15 @@ if (MPPTools.isMacos()) {
|
|||||||
|
|
||||||
project.ext {
|
project.ext {
|
||||||
applicationName = 'Videoplayer'
|
applicationName = 'Videoplayer'
|
||||||
repeatNumber = 2
|
repeatNumber = 10
|
||||||
buildSteps = ["runCinteropFfmpeg": ["$dist/bin/cinterop", "-o", "$dist/../samples/videoplayer/build/classes/kotlin/videoPlayer/main/videoplayer-cinterop-ffmpeg.klib",
|
buildSteps = ["runCinteropFfmpeg": ["${project.getProjectDir()}/$dist/bin/cinterop$toolExtension", "-o", "${project.getProjectDir()}/$dist/../samples/videoplayer/build/classes/kotlin/videoPlayer/main/videoplayer-cinterop-ffmpeg.klib",
|
||||||
"-def", "$dist/../samples/videoplayer/src/nativeInterop/cinterop/ffmpeg.def"] + filterDirsFfmpeg + includeDirsFfmpeg,
|
"-def", "${project.getProjectDir()}/$dist/../samples/videoplayer/src/nativeInterop/cinterop/ffmpeg.def"] + filterDirsFfmpeg + includeDirsFfmpeg,
|
||||||
"runCinteropSdl": ["$dist/bin/cinterop", "-o", "$dist/../samples/videoplayer/build/classes/kotlin/videoPlayer/main/videoplayer-cinterop-sdl.klib",
|
"runCinteropSdl": ["${project.getProjectDir()}/$dist/bin/cinterop$toolExtension", "-o", "${project.getProjectDir()}/$dist/../samples/videoplayer/build/classes/kotlin/videoPlayer/main/videoplayer-cinterop-sdl.klib",
|
||||||
"-def", "$dist/../samples/videoplayer/src/nativeInterop/cinterop/sdl.def"] + includeDirsSdl,
|
"-def", "${project.getProjectDir()}/$dist/../samples/videoplayer/src/nativeInterop/cinterop/sdl.def"] + includeDirsSdl,
|
||||||
"runKonanProgram": ["$dist/bin/konanc", "-ea", "-p", "program", "-o", "${buildDir.absolutePath}/program${MPPTools.getNativeProgramExtension()}",
|
"runKonanProgram": ["${project.getProjectDir()}/$dist/bin/konanc$toolExtension", "-ea", "-p", "program", "-o", "${buildDir.absolutePath}/program${MPPTools.getNativeProgramExtension()}",
|
||||||
"-l", "$dist/../samples/videoplayer/build/classes/kotlin/videoPlayer/main/videoplayer-cinterop-ffmpeg.klib",
|
"-l", "${project.getProjectDir()}/$dist/../samples/videoplayer/build/classes/kotlin/videoPlayer/main/videoplayer-cinterop-ffmpeg.klib",
|
||||||
"-l", "$dist/../samples/videoplayer/build/classes/kotlin/videoPlayer/main/videoplayer-cinterop-sdl.klib",
|
"-l", "${project.getProjectDir()}/$dist/../samples/videoplayer/build/classes/kotlin/videoPlayer/main/videoplayer-cinterop-sdl.klib",
|
||||||
"-Xmulti-platform", "$dist/../samples/videoplayer/src/videoPlayerMain/kotlin",
|
"-Xmulti-platform", "${project.getProjectDir()}/$dist/../samples/videoplayer/src/videoPlayerMain/kotlin",
|
||||||
"-entry", "sample.videoplayer.main"] + linkerOpts]
|
"-entry", "sample.videoplayer.main"] + linkerOpts]
|
||||||
}
|
}
|
||||||
apply from: rootProject.file("${rootProject.rootDir}/gradle/compileBenchmark.gradle")
|
apply from: rootProject.file("${rootProject.rootDir}/gradle/compileBenchmark.gradle")
|
||||||
@@ -82,8 +82,8 @@ data class MeanVarianceBenchmark(val meanBenchmark: BenchmarkResult, val varianc
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun geometricMean(values: List<Double>, totalNumber: Int? = null) =
|
fun geometricMean(values: List<Double>, totalNumber: Int = values.size) =
|
||||||
values.map { it.pow(1.0 / (totalNumber ?: values.size)) }.reduce { a, b -> a * b }
|
values.asSequence().filter{ it != 0.0 }.map { it.pow(1.0 / totalNumber) }.reduce { a, b -> a * b }
|
||||||
|
|
||||||
fun computeMeanVariance(samples: List<Double>): MeanVariance {
|
fun computeMeanVariance(samples: List<Double>): MeanVariance {
|
||||||
val zStar = 1.67 // Critical point for 90% confidence of normal distribution.
|
val zStar = 1.67 // Critical point for 90% confidence of normal distribution.
|
||||||
|
|||||||
@@ -554,7 +554,7 @@ class HTMLRender: Render() {
|
|||||||
|
|
||||||
private fun TableBlock.renderBenchmarksDetails(fullSet: Map<String, SummaryBenchmark>,
|
private fun TableBlock.renderBenchmarksDetails(fullSet: Map<String, SummaryBenchmark>,
|
||||||
bucket: Map<String, ScoreChange>? = null, rowStyle: String? = null) {
|
bucket: Map<String, ScoreChange>? = null, rowStyle: String? = null) {
|
||||||
if (bucket != null) {
|
if (bucket != null && !bucket.isEmpty()) {
|
||||||
// Find max ratio.
|
// Find max ratio.
|
||||||
val maxRatio = bucket.values.map { it.second.mean }.max()!!
|
val maxRatio = bucket.values.map { it.second.mean }.max()!!
|
||||||
// There are changes in performance.
|
// There are changes in performance.
|
||||||
@@ -568,12 +568,13 @@ class HTMLRender: Render() {
|
|||||||
td { +"${fullSet.getValue(name).first}" }
|
td { +"${fullSet.getValue(name).first}" }
|
||||||
td { +"${fullSet.getValue(name).second}" }
|
td { +"${fullSet.getValue(name).second}" }
|
||||||
td {
|
td {
|
||||||
attributes["bgcolor"] = ColoredCell(change.first.mean / abs(bucket.values.first().first.mean))
|
attributes["bgcolor"] = ColoredCell(if (bucket.values.first().first.mean == 0.0) null
|
||||||
|
else change.first.mean / abs(bucket.values.first().first.mean))
|
||||||
.backgroundStyle
|
.backgroundStyle
|
||||||
+"${change.first.toString() + " %"}"
|
+"${change.first.toString() + " %"}"
|
||||||
}
|
}
|
||||||
td {
|
td {
|
||||||
val scaledRatio = change.second.mean / maxRatio
|
val scaledRatio = if (maxRatio == 0.0) null else change.second.mean / maxRatio
|
||||||
attributes["bgcolor"] = ColoredCell(scaledRatio).backgroundStyle
|
attributes["bgcolor"] = ColoredCell(scaledRatio).backgroundStyle
|
||||||
+"${change.second}"
|
+"${change.second}"
|
||||||
}
|
}
|
||||||
@@ -649,18 +650,19 @@ class HTMLRender: Render() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class ColoredCell(val scaledValue: Double, val reverse: Boolean = false) {
|
class ColoredCell(val scaledValue: Double?, val reverse: Boolean = false) {
|
||||||
val value: Double
|
val value: Double
|
||||||
val neutralColor = Color(1.0,1.0 , 1.0)
|
val neutralColor = Color(1.0,1.0 , 1.0)
|
||||||
val negativeColor = Color(0.0, 1.0, 0.0)
|
val negativeColor = Color(0.0, 1.0, 0.0)
|
||||||
val positiveColor = Color(1.0, 0.0, 0.0)
|
val positiveColor = Color(1.0, 0.0, 0.0)
|
||||||
|
|
||||||
init {
|
init {
|
||||||
value = if (abs(scaledValue) <= 1.0) scaledValue else error ("Value should be scaled in range [-1.0; 1.0]")
|
value = scaledValue?.let { if (abs(scaledValue) <= 1.0) scaledValue else error ("Value should be scaled in range [-1.0; 1.0]") }
|
||||||
|
?: 0.0
|
||||||
}
|
}
|
||||||
|
|
||||||
val backgroundStyle: String
|
val backgroundStyle: String
|
||||||
get() = getColor().toString()
|
get() = scaledValue?.let { getColor().toString() } ?: ""
|
||||||
|
|
||||||
fun getColor(): Color {
|
fun getColor(): Color {
|
||||||
val currentValue = clamp(value, -1.0, 1.0)
|
val currentValue = clamp(value, -1.0, 1.0)
|
||||||
|
|||||||
Reference in New Issue
Block a user