Browse Source

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
Nik Clayton 1 year ago
parent
commit
a792d2c0d6
1 changed files with 2 additions and 1 deletions
  1. 2 1
      gradle.properties

+ 2 - 1
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