From a792d2c0d6b94d25277d6698d5e9fed57fc14351 Mon Sep 17 00:00:00 2001 From: Nik Clayton Date: Wed, 1 Mar 2023 21:07:57 +0100 Subject: [PATCH] Enable parallel GC for Gradle builds (#3404) * Enable parallel GC for Gradle builds Per https://developer.android.com/studio/build/optimize-your-build#experiment-with-the-jvm-parallel-garbage-collector I benchmarked this, and p75 incremental build time dropped from 33s to 30s. https://github.com/gradle/gradle/issues/19750 means that if `org.gradle.jvmargs` is set any unchanged default values are lost, so include those too. * Update gradle.properties --- gradle.properties | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 24b3ba994..f7cd3016d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,6 @@ org.gradle.caching=true -org.gradle.jvmargs=-Xmx4g -Dfile.encoding=UTF-8 +# If jvmargs is changed then the default values must also be included, see https://github.com/gradle/gradle/issues/19750 +org.gradle.jvmargs=-XX:+UseParallelGC -Xmx4g -Dfile.encoding=UTF-8 -XX:MaxMetaspaceSize=2g -XX:+HeapDumpOnOutOfMemoryError -Xms256m # use parallel execution org.gradle.parallel=true # https://docs.gradle.org/7.6/userguide/configuration_cache.html