From 91a639ff77c7b54ea4904fba956a8b739b28467c Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Tue, 17 Sep 2019 23:32:06 -0400 Subject: [PATCH] Drop -XX:+UseParallelGC Fixes https://github.com/sbt/sbt/issues/5045 Currently we set `-XX:+UseParallelGC` for JDK greater than 9. This isn't a great default because while the peak throughput is somewhat better than the default g1 collector, the worst case performance is really bad with UseParallelGC, especially when the heap size is large. Given the sudden diversification of JDK implementations, we should stay clear from `-XX` flags, and let the build users add them if they must. --- src/universal/bin/sbt | 16 ---------------- src/universal/bin/sbt.bat | 7 ------- 2 files changed, 23 deletions(-) diff --git a/src/universal/bin/sbt b/src/universal/bin/sbt index dbfcaec53..0fbabf171 100755 --- a/src/universal/bin/sbt +++ b/src/universal/bin/sbt @@ -185,21 +185,6 @@ addDefaultMemory() { fi } -get_gc_opts () { - local older_than_9=$(( $java_version < 9 )) - - if [[ "$older_than_9" == "1" ]]; then - # don't need to worry about gc - echo "" - elif [[ "${JAVA_OPTS}" =~ Use.*GC ]] || [[ "${JAVA_TOOL_OPTIONS}" =~ Use.*GC ]] || [[ "${SBT_OPTS}" =~ Use.*GC ]] ; then - # GC arg has been passed in - don't change - echo "" - else - # Java 9+ so revert to old - echo "-XX:+UseParallelGC" - fi -} - require_arg () { local type="$1" local opt="$2" @@ -381,7 +366,6 @@ run() { else # run sbt execRunner "$java_cmd" \ - $(get_gc_opts) \ "${java_args[@]}" \ "${sbt_options[@]}" \ -jar "$sbt_jar" \ diff --git a/src/universal/bin/sbt.bat b/src/universal/bin/sbt.bat index ac5d33212..d8902fac5 100644 --- a/src/universal/bin/sbt.bat +++ b/src/universal/bin/sbt.bat @@ -198,13 +198,6 @@ if /I %JAVA_VERSION% GEQ 9 ( "%_JAVACMD%" %_JAVA_OPTS% %SBT_OPTS% -jar "!rtexport!" "!java9_rt!" ) set _JAVA_OPTS=!_JAVA_OPTS! -Dscala.ext.dirs="!java9_ext!" - - rem check to see if a GC has been set in the opts - echo !_JAVA_OPTS! | findstr /r "Use.*GC" >nul - if ERRORLEVEL 1 ( - rem don't have a GC set - revert to old GC - set _JAVA_OPTS=!_JAVA_OPTS! -XX:+UseParallelGC - ) ) exit /B 0