spierce7
12/19/2022, 7:34 PMbuild.gradle.kts
changes in the app.
I made a gradle plugin using Kotlin over the weekend, and I was surprised to see things like extensions created via reflection, and things like the project
still being `@Inject`ed into the constructor. Isn't using reflection to create abstract classes and reflection based dependency injection part of the problem why resolving the project configuration takes so long?
Is there any hope for performance in the next few years, as we will surely surpass 200 multiplatform Kotlin modules (which are perhaps heavier than a normal module due to their many configurations?), or do we need to start considering breaking up things into separate repositories?Gavin Ray
12/19/2022, 7:39 PMplugins {}
blocks) can improve build times by 20% if you're able to use it.
Have you tried using 8.0-milestone-5
as your Gradle version, and enabling the below:
# org.gradle.caching=(true,false)
# When set to true, Gradle will reuse task outputs from any previous build, when possible, resulting in much faster builds
org.gradle.caching=true
# org.gradle.configureondemand=(true,false)
# Enables incubating configuration on demand, where Gradle will attempt to configure only necessary projects. Default is false.
org.gradle.configureondemand=true
# org.gradle.parallel=(true,false)
# When configured, Gradle will fork up to org.gradle.workers.max JVMs to execute projects in parallel.
# To learn more about parallel task execution, see the section on Gradle build performance. Default is false.
org.gradle.parallel=true
# The org.gradle.jvmargs Gradle property controls the VM running the build.
# It defaults to -Xmx512m "-XX:MaxMetaspaceSize=256m"
#
# (The important one here is -XX:+TieredCompilation -XX:TieredStopAtLevel=1)
org.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError -Xverify:none \
-XX:+UseParallelGC -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -Dfile.encoding=UTF-8
# <https://kotlinlang.org/docs/whatsnew17.html#a-new-approach-to-incremental-compilation>
kotlin.incremental.useClasspathSnapshot=true
Gavin Ray
12/19/2022, 7:40 PMspierce7
12/19/2022, 7:43 PMorg.gradle.caching=true
caches aren't enabled by default?Gavin Ray
12/19/2022, 7:43 PMbuildSrc
and is based on convention-plugins. We don't have nearly that many that modules though. You may need a lot more memory in the jvmargs
section but the rest of that should all help considerablyspierce7
12/19/2022, 7:44 PMorg.gradle.parallel=true
has been the default for a few years as wellspierce7
12/19/2022, 7:44 PMGavin Ray
12/19/2022, 7:44 PMBy default, the build cache is not enabled. You can enable the build cache in a couple of ways:
spierce7
12/19/2022, 7:45 PMorg.gradle.jvmargs=-Xmx4g -Xms1g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
org.gradle.parallel=true
org.gradle.caching=true
Gavin Ray
12/19/2022, 7:46 PM-XX:+UseParallelGC -XX:+TieredCompilation -XX:TieredStopAtLevel=1
to your jvmargs
-- that'll only run a single JIT pass during development, so it'll be significantly faster. The Parallel GC is optional but usually a decent default
You may also look into enabling org.gradle.configureondemand=true
so that tasks only fire when necessaryGavin Ray
12/19/2022, 7:46 PMspierce7
12/19/2022, 7:47 PMthat'll only run a single JIT passBecause of the daemon though, isn't it ok to let it just do it's thing?
spierce7
12/19/2022, 7:48 PMGavin Ray
12/19/2022, 7:50 PMsync
code since there's no compilation happeningVampire
12/19/2022, 7:50 PMGavin Ray
12/19/2022, 7:51 PMdistributionUrl=https:\//services.gradle.org/distributions/gradle-8.0-milestone-5-bin.zip
Gavin Ray
12/19/2022, 7:52 PMGavin Ray
12/19/2022, 7:52 PMeygraber
12/19/2022, 9:10 PMspierce7
12/19/2022, 10:09 PMeygraber
12/19/2022, 10:26 PMVampire
12/19/2022, 11:36 PMmbonnin
12/20/2022, 9:35 AMmbonnin
12/20/2022, 9:36 AMmbonnin
12/20/2022, 9:38 AMVampire
12/20/2022, 9:46 AM