Replace reflection-based compiler arguments copying with generated code
Using of Kotlin reflection for simple operations like bean management is very slow First time initialization time: 261 ms for `copyBean(K2JVMCompilerArguments())` Subsequent calls of `copyBean(K2JVMCompilerArguments())` take 1.7 ms per call Unfortunately compiler argument handling is also used in Kotlin IntelliJ plugin to parse facet settings. Big projects may have thousands of Kotlin facets The same `ArgumentUtilsKt.copyProperties` frame is seen across various freezes: IDEA-252440 2-3 minutes freeze on Kotlin project reimporting in last 203 eap IDEA-253107 A lot of short freezes (1-3 sec) during Kotlin project development KTIJ-23501 Make main run configuration detection lighter KTIJ-22435 Unresponsive UI with 100% cpu Reflection issue: KT-56358 KClasses.getMemberProperties takes too much time This commit replaces all reflection stuff with a simple code generation Now `K2JVMCompilerArguments().clone()` goes to hard-to-measure time
This commit is contained in:
+4
-3
@@ -21,8 +21,7 @@ import org.gradle.api.provider.ProviderFactory
|
||||
import org.gradle.api.tasks.*
|
||||
import org.gradle.process.ExecOperations
|
||||
import org.gradle.work.NormalizeLineEndings
|
||||
import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments
|
||||
import org.jetbrains.kotlin.cli.common.arguments.CommonToolArguments
|
||||
import org.jetbrains.kotlin.cli.common.arguments.*
|
||||
import org.jetbrains.kotlin.compilerRunner.*
|
||||
import org.jetbrains.kotlin.compilerRunner.KotlinNativeCInteropRunner.Companion.run
|
||||
import org.jetbrains.kotlin.gradle.dsl.*
|
||||
@@ -300,7 +299,9 @@ abstract class AbstractKotlinNativeCompile<
|
||||
}
|
||||
|
||||
// Remove it once actual K2NativeCompilerArguments will be available without 'kotlin.native.enabled = true' flag
|
||||
class StubK2NativeCompilerArguments : CommonCompilerArguments()
|
||||
class StubK2NativeCompilerArguments : CommonCompilerArguments() {
|
||||
override fun copyOf(): Freezable = copyCommonCompilerArguments(this, StubK2NativeCompilerArguments())
|
||||
}
|
||||
|
||||
/**
|
||||
* A task producing a klibrary from a compilation.
|
||||
|
||||
Reference in New Issue
Block a user