blob: 157eb88aa661e8b4acd428f782d0317b1621bd4e [file] [log] [blame]
Roman Elizarov1f74a2d2018-06-29 19:19:45 +03001/*
2 * Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
3 */
Vsevolod Tolstopyatovc42d3382019-04-30 15:18:36 +03004sourceCompatibility = 1.8
5targetCompatibility = 1.8
Roman Elizarov1f74a2d2018-06-29 19:19:45 +03006
Vsevolod Tolstopyatov305c66a2018-08-21 21:01:58 +03007apply plugin: "net.ltgt.apt"
8apply plugin: "com.github.johnrengelman.shadow"
9apply plugin: "me.champeau.gradle.jmh"
Kirill Timofeeva5186962017-10-25 14:25:47 +030010
11repositories {
Roman Elizarov63d1d1b2019-02-22 14:40:38 +030012 maven { url "https://repo.typesafe.com/typesafe/releases/" }
Kirill Timofeeva5186962017-10-25 14:25:47 +030013}
14
Vsevolod Tolstopyatovc42d3382019-04-30 15:18:36 +030015compileJmhKotlin {
16 kotlinOptions {
17 jvmTarget = "1.8"
18 freeCompilerArgs += ['-Xjvm-default=enable']
19 }
20}
21
22/*
23 * Due to a bug in the inliner it sometimes does not remove inlined symbols (that are later renamed) from unused code paths,
24 * and it breaks JMH that tries to post-process these symbols and fails because they are renamed.
25 */
26task removeRedundantFiles(type: Delete) {
27 delete "$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleOpt\$play\$buildHistoOnScore\$1\$\$special\$\$inlined\$filter\$1\$1.class"
28 delete "$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleOpt\$play\$nBlanks\$1\$\$special\$\$inlined\$map\$1\$1.class"
29 delete "$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleOpt\$play\$score2\$1\$\$special\$\$inlined\$map\$1\$1.class"
30 delete "$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleOpt\$play\$bonusForDoubleLetter\$1\$\$special\$\$inlined\$map\$1\$1.class"
31 delete "$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleOpt\$play\$nBlanks\$1\$\$special\$\$inlined\$map\$1\$2\$1.class"
32 delete "$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleOpt\$play\$bonusForDoubleLetter\$1\$\$special\$\$inlined\$map\$1\$2\$1.class"
33 delete "$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleOpt\$play\$score2\$1\$\$special\$\$inlined\$map\$1\$2\$1.class"
34 delete "$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleOptKt\$\$special\$\$inlined\$collect\$1\$1.class"
35 delete "$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleOptKt\$\$special\$\$inlined\$collect\$2\$1.class"
36 delete "$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleOpt\$play\$histoOfLetters\$1\$\$special\$\$inlined\$fold\$1\$1.class"
Vsevolod Tolstopyatovc42d3382019-04-30 15:18:36 +030037 delete "$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleBase\$play\$buildHistoOnScore\$1\$\$special\$\$inlined\$filter\$1\$1.class"
38 delete "$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleBase\$play\$histoOfLetters\$1\$\$special\$\$inlined\$fold\$1\$1.class"
Vsevolod Tolstopyatovc42d3382019-04-30 15:18:36 +030039 delete "$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble//SaneFlowPlaysScrabble\$play\$buildHistoOnScore\$1\$\$special\$\$inlined\$filter\$1\$1.class"
40
Vsevolod Tolstopyatovc438a0e2019-04-30 16:36:14 +030041 // Primes
42 delete "$buildDir/classes/kotlin/jmh/benchmarks/flow/misc/Numbers\$\$special\$\$inlined\$filter\$1\$2\$1.class"
43 delete "$buildDir/classes/kotlin/jmh/benchmarks/flow/misc/Numbers\$\$special\$\$inlined\$filter\$1\$1.class"
Vsevolod Tolstopyatovc42d3382019-04-30 15:18:36 +030044}
45
46jmhRunBytecodeGenerator.dependsOn(removeRedundantFiles)
Vsevolod Tolstopyatov305c66a2018-08-21 21:01:58 +030047
Nikita Koval74b250f2019-03-19 13:24:07 +030048// It is better to use the following to run benchmarks, otherwise you may get unexpected errors:
Vsevolod Tolstopyatovc42d3382019-04-30 15:18:36 +030049// ./gradlew --no-daemon cleanJmhJar jmh -Pjmh="MyBenchmark"
Vsevolod Tolstopyatove50a0fa2019-01-28 11:34:24 +030050jmh {
Vsevolod Tolstopyatovc42d3382019-04-30 15:18:36 +030051 jmhVersion = '1.21'
Vsevolod Tolstopyatove50a0fa2019-01-28 11:34:24 +030052 duplicateClassesStrategy DuplicatesStrategy.INCLUDE
Nikita Koval74b250f2019-03-19 13:24:07 +030053 failOnError = true
54 resultFormat = 'CSV'
Vsevolod Tolstopyatovc42d3382019-04-30 15:18:36 +030055 if (project.hasProperty('jmh')) {
56 include = ".*" + project.jmh + ".*"
57 }
58// includeTests = false
Vsevolod Tolstopyatove50a0fa2019-01-28 11:34:24 +030059}
60
Vsevolod Tolstopyatov305c66a2018-08-21 21:01:58 +030061jmhJar {
62 baseName 'benchmarks'
63 classifier = null
64 version = null
Vsevolod Tolstopyatovf284dfc2018-09-20 12:00:31 +030065 destinationDir = file("$rootDir")
Kirill Timofeeva5186962017-10-25 14:25:47 +030066}
67
Vsevolod Tolstopyatov305c66a2018-08-21 21:01:58 +030068dependencies {
Vsevolod Tolstopyatov305c66a2018-08-21 21:01:58 +030069 compile "org.openjdk.jmh:jmh-core:1.21"
Vsevolod Tolstopyatovc42d3382019-04-30 15:18:36 +030070 compile "io.projectreactor:reactor-core:$reactor_vesion"
71 compile 'io.reactivex.rxjava2:rxjava:2.1.9'
72 compile "com.github.akarnokd:rxjava2-extensions:0.20.8"
73
74 compile "org.openjdk.jmh:jmh-core:1.21"
Vsevolod Tolstopyatove50a0fa2019-01-28 11:34:24 +030075 compile 'com.typesafe.akka:akka-actor_2.12:2.5.0'
76 compile project(':kotlinx-coroutines-core')
Vsevolod Tolstopyatov305c66a2018-08-21 21:01:58 +030077}