FIR IDE: add perf tests for completion

This commit is contained in:
Ilya Kirillov
2021-01-11 15:53:32 +01:00
parent a4cf21adef
commit 49a4ec7f92
3 changed files with 54 additions and 12 deletions
@@ -11,9 +11,8 @@ class WholeProjectPerformanceComparisonFirImplTest : AbstractWholeProjectPerform
override val testPrefix: String = "FIR" override val testPrefix: String = "FIR"
override fun getWarmUpProject(): WarmUpProject = warmUpProject override fun getWarmUpProject(): WarmUpProject = warmUpProject
fun testRustPlugin() { fun testRustPluginHighlighting() = doTestRustPluginHighlighting()
doTestRustPlugin() fun testRustPluginCompletion() = doTestRustPluginCompletion()
}
companion object { companion object {
private val hwStats: Stats = Stats("FIR warmup project") private val hwStats: Stats = Stats("FIR warmup project")
@@ -11,9 +11,9 @@ class WholeProjectPerformanceComparisonFE10ImplTest : AbstractWholeProjectPerfor
override val testPrefix: String = "FE10" override val testPrefix: String = "FE10"
override fun getWarmUpProject(): WarmUpProject = warmUpProject override fun getWarmUpProject(): WarmUpProject = warmUpProject
fun testRustPlugin() { fun testRustPluginHighlighting() = doTestRustPluginHighlighting()
doTestRustPlugin() fun testRustPluginCompletion() = doTestRustPluginCompletion()
}
companion object { companion object {
private val hwStats: Stats = Stats("FE10 warmup project") private val hwStats: Stats = Stats("FE10 warmup project")
@@ -19,18 +19,56 @@ abstract class AbstractWholeProjectPerformanceComparisonTest : AbstractPerforman
getWarmUpProject().warmUp(this) getWarmUpProject().warmUp(this)
} }
protected fun doTestRustPlugin() { protected fun doTestRustPluginHighlighting() {
TeamCity.suite("$testPrefix Rust plugin") { TeamCity.suite("$testPrefix highlighting in Rust plugin") {
Stats("$testPrefix Rust plugin").use { Stats("$testPrefix highlighting in Rust plugin").use { stat ->
perfOpenRustPluginProject(it) perfOpenRustPluginProject(stat)
val filesToHighlight = arrayOf( val filesToHighlight = arrayOf(
"src/main/kotlin/org/rust/ide/inspections/RsExternalLinterInspection.kt", "src/main/kotlin/org/rust/ide/inspections/RsExternalLinterInspection.kt",
"src/main/kotlin/org/rust/ide/injected/RsDoctestLanguageInjector.kt", "src/main/kotlin/org/rust/ide/injected/RsDoctestLanguageInjector.kt",
"src/main/kotlin/org/rust/cargo/runconfig/filters/RegexpFileLinkFilter.kt", FILE_NAMES.REGEXP_FILE_LINK_FILTER,
"src/main/kotlin/org/rust/cargo/util/CargoOptions.kt",
"src/main/kotlin/org/rust/lang/core/macros/MacroExpansionManager.kt",
FILE_NAMES.NAME_RESOLUTION
) )
filesToHighlight.forEach { file -> perfHighlightFile(file, stats = it) } filesToHighlight.forEach { file -> perfHighlightFileEmptyProfile(file, stats = stat) }
}
}
}
protected fun doTestRustPluginCompletion() {
TeamCity.suite("$testPrefix completion in Rust plugin") {
Stats("$testPrefix completion in Rust plugin").use { stat ->
perfOpenRustPluginProject(stat)
perfTypeAndAutocomplete(
stat,
fileName = FILE_NAMES.REGEXP_FILE_LINK_FILTER,
marker = "fun applyFilter(line: String, entireLength: Int): Filter.Result? {",
insertString = "val a = l",
lookupElements = listOf("line"),
note = "in-method completion"
)
perfTypeAndAutocomplete(
stat,
fileName = FILE_NAMES.NAME_RESOLUTION,
marker = "private data class ImplicitStdlibCrate(val name: String, val crateRoot: RsFile)",
insertString = "\nval a = ",
lookupElements = listOf("processAssocTypeVariants"),
note = "top-level completion"
)
perfTypeAndAutocomplete(
stat,
fileName = FILE_NAMES.NAME_RESOLUTION,
marker = "testAssert { cameFrom.context == scope }",
insertString = "\nval a = s",
lookupElements = listOf("scope"),
note = "in big method in big file completion"
)
} }
} }
} }
@@ -45,5 +83,10 @@ abstract class AbstractWholeProjectPerformanceComparisonTest : AbstractPerforman
fast = true fast = true
) )
} }
private object FILE_NAMES {
const val NAME_RESOLUTION = "src/main/kotlin/org/rust/lang/core/resolve/NameResolution.kt"
const val REGEXP_FILE_LINK_FILTER = "src/main/kotlin/org/rust/cargo/runconfig/filters/RegexpFileLinkFilter.kt"
}
} }