Some fixes in perf task to make it more reliable
This commit is contained in:
@@ -95,10 +95,12 @@ task bench(type:DefaultTask) {
|
||||
def konanReport = new Report(project.file("build/konanReport.txt"))
|
||||
def average = "none"
|
||||
def absoluteAverage = "none"
|
||||
jvmReport.report.each { k, v ->
|
||||
jvmReport.report
|
||||
.sort { konanReport.report[it.key] / it.value }
|
||||
.each { k, v ->
|
||||
def konanValue = konanReport.report[k]
|
||||
def ratio = String.format('%.2f', konanValue/v)
|
||||
def formattedKonanValue = String.format('%.2f', konanValue/1000)
|
||||
def ratio = String.format('%.2f', konanValue / v)
|
||||
def formattedKonanValue = String.format('%.2f', konanValue / 1000)
|
||||
if (k == 'RingAverage') {
|
||||
average = ratio
|
||||
absoluteAverage = formattedKonanValue
|
||||
|
||||
@@ -19,7 +19,7 @@ package org.jetbrains.ring
|
||||
var globalAddendum = 0
|
||||
|
||||
open class LambdaBenchmark {
|
||||
private fun <T> runLambda(x: () -> T): T = x()
|
||||
private inline fun <T> runLambda(x: () -> T): T = x()
|
||||
private fun <T> runLambdaNoInline(x: () -> T): T = x()
|
||||
|
||||
fun setup() {
|
||||
|
||||
@@ -41,7 +41,7 @@ class Launcher(val numWarmIterations: Int) {
|
||||
}
|
||||
cleanup()
|
||||
}
|
||||
if (time >= 100L * 1_000_000) // 100ms
|
||||
if (time >= 200L * 1_000_000) // 200ms
|
||||
break
|
||||
autoEvaluatedNumberOfMeasureIteration *= 2
|
||||
}
|
||||
@@ -103,18 +103,15 @@ class Launcher(val numWarmIterations: Int) {
|
||||
fun printResultsNormalized() {
|
||||
var total = 0.0
|
||||
results.asSequence().sortedBy { it.key }.forEach {
|
||||
val normaTime = NormaResults[it.key]
|
||||
if (normaTime == null) println("ERROR: no norma for benchmark ${it.key}")
|
||||
|
||||
val norma = it.value.toDouble() / normaTime!!.toDouble()
|
||||
val norma = it.value.toDouble()
|
||||
val niceName = it.key.padEnd(50, ' ')
|
||||
val niceNorma = norma.toString(2).padStart(10, ' ')
|
||||
val niceNorma = norma.toString(9)
|
||||
println("$niceName : $niceNorma")
|
||||
|
||||
total += norma
|
||||
}
|
||||
val average = total / results.size
|
||||
println("\nRingAverage: ${average.toString(2)}")
|
||||
println("\nRingAverage: ${average.toString(9)}")
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------//
|
||||
|
||||
@@ -1,178 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.ring
|
||||
|
||||
val NormaResults = mapOf(
|
||||
"AbstractMethod.sortStrings" to 1842L,
|
||||
"AbstractMethod.sortStringsWithComparator" to 2775L,
|
||||
"ClassArray.copy" to 148L,
|
||||
"ClassArray.copyManual" to 456L,
|
||||
"ClassArray.filterAndCount" to 2197L,
|
||||
"ClassArray.filterAndMap" to 3081L,
|
||||
"ClassArray.filterAndMapManual" to 2896L,
|
||||
"ClassArray.filter" to 2281L,
|
||||
"ClassArray.filterManual" to 2176L,
|
||||
"ClassArray.countFilteredManual" to 2403L,
|
||||
"ClassArray.countFiltered" to 2062L,
|
||||
"ClassArray.countFilteredLocal" to 2065L,
|
||||
"ClassBaseline.consume" to 8950L,
|
||||
"ClassBaseline.consumeField" to 219L,
|
||||
"ClassBaseline.allocateList" to 48L,
|
||||
"ClassBaseline.allocateArray" to 30L,
|
||||
"ClassBaseline.allocateListAndFill" to 6084L,
|
||||
"ClassBaseline.allocateListAndWrite" to 314L,
|
||||
"ClassBaseline.allocateArrayAndFill" to 5782L,
|
||||
"ClassList.copy" to 41L,
|
||||
"ClassList.copyManual" to 570L,
|
||||
"ClassList.filterAndCount" to 2260L,
|
||||
"ClassList.filterAndCountWithLambda" to 573L,
|
||||
"ClassList.filterWithLambda" to 630L,
|
||||
"ClassList.mapWithLambda" to 7750L,
|
||||
"ClassList.countWithLambda" to 151L,
|
||||
"ClassList.filterAndMapWithLambda" to 4686L,
|
||||
"ClassList.filterAndMapWithLambdaAsSequence" to 4814L,
|
||||
"ClassList.filterAndMap" to 3131L,
|
||||
"ClassList.filterAndMapManual" to 3075L,
|
||||
"ClassList.filter" to 2342L,
|
||||
"ClassList.filterManual" to 2347L,
|
||||
"ClassList.countFilteredManual" to 2186L,
|
||||
"ClassList.countFiltered" to 2187L,
|
||||
"ClassList.reduce" to 2208L,
|
||||
"ClassStream.copy" to 820L,
|
||||
"ClassStream.copyManual" to 705L,
|
||||
"ClassStream.filterAndCount" to 2772L,
|
||||
"ClassStream.filterAndMap" to 3654L,
|
||||
"ClassStream.filterAndMapManual" to 2894L,
|
||||
"ClassStream.filter" to 2377L,
|
||||
"ClassStream.filterManual" to 2206L,
|
||||
"ClassStream.countFilteredManual" to 2235L,
|
||||
"ClassStream.countFiltered" to 2466L,
|
||||
"ClassStream.reduce" to 2211L,
|
||||
"CompanionObject.invokeRegularFunction" to 5L,
|
||||
"CompanionObject.invokeJvmStaticFunction" to 5L,
|
||||
"DefaultArgument.testOneOfTwo" to 5L,
|
||||
"DefaultArgument.testTwoOfTwo" to 5L,
|
||||
"DefaultArgument.testOneOfFour" to 5L,
|
||||
"DefaultArgument.testFourOfFour" to 5L,
|
||||
"DefaultArgument.testOneOfEight" to 5L,
|
||||
"DefaultArgument.testEightOfEight" to 5L,
|
||||
"Elvis.testElvis" to 123L,
|
||||
"Euler.problem1bySequence" to 345L,
|
||||
"Euler.problem1" to 143L,
|
||||
"Euler.problem2" to 143L,
|
||||
"Euler.problem4" to 66281L,
|
||||
"Euler.problem8" to 14927L,
|
||||
"Euler.problem9" to 964L,
|
||||
"Euler.problem14" to 5327L,
|
||||
"Euler.problem14full" to 22262L,
|
||||
"Fibonacci.calcClassic" to 48L,
|
||||
"Fibonacci.calc" to 48L,
|
||||
"Fibonacci.calcWithProgression" to 184L,
|
||||
"Fibonacci.calcSquare" to 5225L,
|
||||
"Inline.calculate" to 47L,
|
||||
"Inline.calculateInline" to 43L,
|
||||
"Inline.calculateGeneric" to 36L,
|
||||
"Inline.calculateGenericInline" to 31L,
|
||||
"IntArray.copy" to 578L,
|
||||
"IntArray.copyManual" to 385L,
|
||||
"IntArray.filterAndCount" to 3497L,
|
||||
"IntArray.filterSomeAndCount" to 387L,
|
||||
"IntArray.filterAndMap" to 3709L,
|
||||
"IntArray.filterAndMapManual" to 3899L,
|
||||
"IntArray.filter" to 3605L,
|
||||
"IntArray.filterSome" to 317L,
|
||||
"IntArray.filterPrime" to 542L,
|
||||
"IntArray.filterManual" to 3284L,
|
||||
"IntArray.filterSomeManual" to 327L,
|
||||
"IntArray.countFilteredManual" to 3871L,
|
||||
"IntArray.countFilteredSomeManual" to 194L,
|
||||
"IntArray.countFilteredPrimeManual" to 438L,
|
||||
"IntArray.countFiltered" to 3120L,
|
||||
"IntArray.countFilteredSome" to 194L,
|
||||
"IntArray.countFilteredPrime" to 436L,
|
||||
"IntArray.countFilteredLocal" to 3425L,
|
||||
"IntArray.countFilteredSomeLocal" to 208L,
|
||||
"IntArray.reduce" to 3210L,
|
||||
"IntBaseline.consume" to 34L,
|
||||
"IntBaseline.allocateList" to 37L,
|
||||
"IntBaseline.allocateArray" to 43L,
|
||||
"IntBaseline.allocateListAndFill" to 335L,
|
||||
"IntBaseline.allocateArrayAndFill" to 67L,
|
||||
"IntList.copy" to 38L,
|
||||
"IntList.copyManual" to 680L,
|
||||
"IntList.filterAndCount" to 3470L,
|
||||
"IntList.filterAndMap" to 3829L,
|
||||
"IntList.filterAndMapManual" to 3775L,
|
||||
"IntList.filter" to 3726L,
|
||||
"IntList.filterManual" to 3376L,
|
||||
"IntList.countFilteredManual" to 3119L,
|
||||
"IntList.countFiltered" to 3107L,
|
||||
"IntList.countFilteredLocal" to 3108L,
|
||||
"IntList.reduce" to 3114L,
|
||||
"IntStream.copy" to 984L,
|
||||
"IntStream.copyManual" to 668L,
|
||||
"IntStream.filterAndCount" to 3532L,
|
||||
"IntStream.filterAndMap" to 3948L,
|
||||
"IntStream.filterAndMapManual" to 3581L,
|
||||
"IntStream.filter" to 3350L,
|
||||
"IntStream.filterManual" to 3638L,
|
||||
"IntStream.countFilteredManual" to 3508L,
|
||||
"IntStream.countFiltered" to 3337L,
|
||||
"IntStream.countFilteredLocal" to 3215L,
|
||||
"IntStream.reduce" to 5399L,
|
||||
"Lambda.noncapturingLambda" to 224L,
|
||||
"Lambda.noncapturingLambdaNoInline" to 202L,
|
||||
"Lambda.capturingLambda" to 26L,
|
||||
"Lambda.capturingLambdaNoInline" to 26L,
|
||||
"Lambda.mutatingLambda" to 49L,
|
||||
"Lambda.mutatingLambdaNoInline" to 49L,
|
||||
"Lambda.methodReference" to 202L,
|
||||
"Lambda.methodReferenceNoInline" to 203L,
|
||||
"Loop.arrayLoop" to 191L,
|
||||
"Loop.arrayIndexLoop" to 209L,
|
||||
"Loop.rangeLoop" to 34L,
|
||||
"Loop.arrayListLoop" to 335L,
|
||||
"Loop.arrayWhileLoop" to 222L,
|
||||
"Loop.arrayForeachLoop" to 188L,
|
||||
"Loop.arrayListForeachLoop" to 298L,
|
||||
"MatrixMap.add" to 8446L,
|
||||
"ParameterNotNull.invokeOneArgWithNullCheck" to 5L,
|
||||
"ParameterNotNull.invokeOneArgWithoutNullCheck" to 5L,
|
||||
"ParameterNotNull.invokeTwoArgsWithNullCheck" to 5L,
|
||||
"ParameterNotNull.invokeTwoArgsWithoutNullCheck" to 5L,
|
||||
"ParameterNotNull.invokeEightArgsWithNullCheck" to 5L,
|
||||
"ParameterNotNull.invokeEightArgsWithoutNullCheck" to 5L,
|
||||
"PrimeList.calcDirect" to 860L,
|
||||
"PrimeList.calcEratosthenes" to 3698L,
|
||||
"String.stringConcat" to 2212L,
|
||||
"String.stringConcatNullable" to 9354L,
|
||||
"String.stringBuilderConcat" to 977L,
|
||||
"String.stringBuilderConcatNullable" to 951L,
|
||||
"String.summarizeSplittedCsv" to 31226L,
|
||||
"Switch.testSparseIntSwitch" to 300L,
|
||||
"Switch.testDenseIntSwitch" to 283L,
|
||||
"Switch.testConstSwitch" to 276L,
|
||||
"Switch.testObjConstSwitch" to 282L,
|
||||
"Switch.testVarSwitch" to 548L,
|
||||
"Switch.testStringsSwitch" to 1043L,
|
||||
"Switch.testEnumsSwitch" to 177L,
|
||||
"Switch.testDenseEnumsSwitch" to 208L,
|
||||
"Switch.testSealedWhenSwitch" to 172L,
|
||||
"WithIndicies.withIndicies" to 2303L,
|
||||
"WithIndicies.withIndiciesManual" to 2256L,
|
||||
"OctoTest" to 2515062L
|
||||
)
|
||||
Reference in New Issue
Block a user