Skip to content

Commit 5bbad46

Browse files
authored
Improve check build performance (#299)
- Enable parallel execution - Set examples to run serially. Since they perform the same queries, it results in faster builds when API cache is enabled, as the first example can store cache for the next ones. When running examples, should decide whether to run parallel based on whether API cache is enabled. Intentionally not reading whether cache is enabled to keep it explicit. - Lower KotlinCompileDaemon heap for `build-logic`. This build uses a separate daemon because the embedded Kotlin for Gradle Kotlin DSL is 1.9.22, while the main build's is 2.0.20. - Also set toolchain for `build-logic` ### Difference in KotlinCompileDaemon args Comparison of both builds daemon args, logged when `--info` <img width="794" alt="Screenshot 2024-09-09 at 11 18 59" src="https://github.com/user-attachments/assets/cba0ebd5-8936-4d19-bd80-e30a195d2313"> ### Check builds - build with `-PparallelExamples=true`: https://scans.gradle.com/s/ss2whvbc4uhdo - build with `-PparallelExamples=false` (default): https://scans.gradle.com/s/hl35ecmhfppse #### Benchmarks ##### Before lowering KCD heap <img width="1333" alt="Screenshot 2024-09-09 at 11 53 17" src="https://github.com/user-attachments/assets/7cb4b066-8dd9-4da0-9d71-aec2c873ef29"> ##### After lowering KCD heap <img width="1313" alt="Screenshot 2024-09-09 at 11 54 33" src="https://github.com/user-attachments/assets/884cb52a-19e9-4b3f-8ea1-1e9a7a4729c1">
1 parent a6b6141 commit 5bbad46

File tree

5 files changed

+20
-0
lines changed

5 files changed

+20
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
out
44
!*/src/**/out
55

6+
gradle-user-home
7+
profile-out*
8+
69
build
710
!.github/actions/build
811
!*/src/**/build

build-logic/build.gradle.kts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ plugins {
44
`kotlin-dsl`
55
}
66

7+
java {
8+
toolchain {
9+
languageVersion.set(JavaLanguageVersion.of(11))
10+
vendor.set(JvmVendorSpec.AZUL)
11+
}
12+
}
13+
714
testing {
815
suites {
916
register<JvmTestSuite>("functionalTest") {

build-logic/gradle.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
kotlin.daemon.jvmargs=-Xmx1g

examples/build.gradle.kts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,13 @@ val runAll = tasks.register("runAll") {
6464
dependsOn(exampleTestTasks)
6565
}
6666

67+
val parallelExamples: String? by project
68+
if (!parallelExamples.toBoolean()) {
69+
exampleTestTasks.windowed(size = 2, step = 1).forEach { (a, b) ->
70+
b.configure { mustRunAfter(a) }
71+
}
72+
}
73+
6774
tasks.named("check") {
6875
dependsOn(runAll)
6976
}

gradle.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ artifact=develocity-api-kotlin
33
version=2024.2.0-alpha02
44
develocity.version=2024.2
55
repo.url=https://github.com/gabrielfeo/develocity-api-kotlin
6+
parallelExamples=false
7+
org.gradle.parallel=true
68
org.gradle.jvmargs=-Xmx5g
79
org.gradle.caching=true
810
# Becomes default in Gradle 9.0

0 commit comments

Comments
 (0)