diff --git a/idea/idea-fir-performance-tests/build.gradle.kts b/idea/idea-fir-performance-tests/build.gradle.kts index e42c4a488c2..6f26e7228e2 100644 --- a/idea/idea-fir-performance-tests/build.gradle.kts +++ b/idea/idea-fir-performance-tests/build.gradle.kts @@ -30,6 +30,29 @@ dependencies { testRuntime(intellijDep()) compile(intellijPluginDep("java")) + testRuntimeOnly(intellijPluginDep("java")) + + testRuntimeOnly(intellijDep()) + testRuntimeOnly(intellijRuntimeAnnotations()) + testRuntimeOnly(toolsJar()) + testRuntimeOnly(project(":kotlin-reflect")) + testRuntimeOnly(project(":plugins:android-extensions-ide")) + testRuntimeOnly(project(":plugins:kapt3-idea")) + testRuntimeOnly(project(":sam-with-receiver-ide-plugin")) + testRuntimeOnly(project(":noarg-ide-plugin")) + testRuntimeOnly(project(":allopen-ide-plugin")) + testRuntimeOnly(project(":kotlin-scripting-idea")) + testRuntimeOnly(project(":kotlinx-serialization-ide-plugin")) + testRuntimeOnly(project(":plugins:parcelize:parcelize-ide")) + testRuntimeOnly(project(":nj2k:nj2k-services")) + testRuntimeOnly(project(":kotlin-reflect")) + testRuntimeOnly(project(":idea:kotlin-gradle-tooling")) + testRuntimeOnly(project(":kotlin-gradle-statistics")) + + testImplementation("khttp:khttp:1.0.0") + + testImplementation(intellijPluginDep("gradle-java")) + testRuntimeOnly(intellijPluginDep("gradle-java")) } sourceSets { @@ -51,6 +74,7 @@ projectTest(parallel = true) { testsJar() projectTest(taskName = "ideaFirPerformanceTest") { + exclude("**/*WholeProjectPerformanceComparisonFirImplTest*") val currentOs = org.gradle.internal.os.OperatingSystem.current() if (!currentOs.isWindows) { @@ -92,3 +116,28 @@ projectTest(taskName = "ideaFirPerformanceTest") { systemProperty("kotlin.test.gradle.import.arguments", "-PcacheRedirectorEnabled=$it") } } + +projectTest(taskName = "firProjectPerformanceTest") { + include("**/*WholeProjectPerformanceComparisonFirImplTest*") + + workingDir = rootDir + + jvmArgs?.removeAll { it.startsWith("-Xmx") } + + maxHeapSize = "3g" + jvmArgs("-DperformanceProjects=${System.getProperty("performanceProjects")}") + jvmArgs("-Didea.debug.mode=true") + jvmArgs("-DemptyProfile=${System.getProperty("emptyProfile")}") + jvmArgs("-XX:SoftRefLRUPolicyMSPerMB=50") + jvmArgs( + "-XX:+UseCompressedOops", + "-XX:+UseConcMarkSweepGC" + ) + + doFirst { + systemProperty("idea.home.path", intellijRootDir().canonicalPath) + project.findProperty("cacheRedirectorEnabled")?.let { + systemProperty("kotlin.test.gradle.import.arguments", "-PcacheRedirectorEnabled=$it") + } + } +} diff --git a/idea/idea-fir-performance-tests/tests/org/jetbrains/kotlin/idea/perf/WholeProjectPerformanceComparisonFirImplTest.kt b/idea/idea-fir-performance-tests/tests/org/jetbrains/kotlin/idea/perf/WholeProjectPerformanceComparisonFirImplTest.kt new file mode 100644 index 00000000000..608f152fc3c --- /dev/null +++ b/idea/idea-fir-performance-tests/tests/org/jetbrains/kotlin/idea/perf/WholeProjectPerformanceComparisonFirImplTest.kt @@ -0,0 +1,22 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.idea.perf + +import org.jetbrains.kotlin.idea.perf.common.AbstractWholeProjectPerformanceComparisonTest + +class WholeProjectPerformanceComparisonFirImplTest : AbstractWholeProjectPerformanceComparisonTest() { + override val testPrefix: String = "FIR" + override fun getWarmUpProject(): WarmUpProject = warmUpProject + + fun testRustPlugin() { + doTestRustPlugin() + } + + companion object { + private val hwStats: Stats = Stats("FIR warmup project") + private val warmUpProject = WarmUpProject(hwStats) + } +} \ No newline at end of file diff --git a/idea/performanceTests/test/org/jetbrains/kotlin/idea/perf/common/AbstractWholeProjectPerformanceComparisonTest.kt b/idea/performanceTests/test/org/jetbrains/kotlin/idea/perf/common/AbstractWholeProjectPerformanceComparisonTest.kt new file mode 100644 index 00000000000..f74722a447c --- /dev/null +++ b/idea/performanceTests/test/org/jetbrains/kotlin/idea/perf/common/AbstractWholeProjectPerformanceComparisonTest.kt @@ -0,0 +1,49 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.idea.perf.common + +import org.jetbrains.kotlin.idea.perf.* +import org.jetbrains.kotlin.idea.perf.util.TeamCity +import org.jetbrains.kotlin.idea.testFramework.ProjectOpenAction + +abstract class AbstractWholeProjectPerformanceComparisonTest : AbstractPerformanceProjectsTest() { + abstract val testPrefix: String + + abstract fun getWarmUpProject(): WarmUpProject + + override fun setUp() { + super.setUp() + getWarmUpProject().warmUp(this) + } + + protected fun doTestRustPlugin() { + TeamCity.suite("$testPrefix Rust plugin") { + Stats("$testPrefix Rust plugin").use { + perfOpenRustPluginProject(it) + + val filesToHighlight = arrayOf( + "src/main/kotlin/org/rust/ide/inspections/RsExternalLinterInspection.kt", + "src/main/kotlin/org/rust/ide/injected/RsDoctestLanguageInjector.kt", + "src/main/kotlin/org/rust/cargo/runconfig/filters/RegexpFileLinkFilter.kt", + ) + + filesToHighlight.forEach { file -> perfHighlightFile(file, stats = it) } + } + } + } + + private fun perfOpenRustPluginProject(stats: Stats) { + myProject = perfOpenProject( + name = "intellijRustPlugin", + stats = stats, + note = "", + path = "../intellij-rust", + openAction = ProjectOpenAction.GRADLE_PROJECT, + fast = true + ) + } +} +