Bug 1894716 - Change Android build to use -O2 optimization level a=pascalc

Optimize android at "-O2" (speed) instead of "-Oz" (reduced code size) because the performance improvements on benchmarks and pageload outweigh the expected increased in binary size.

Original Revision: https://phabricator.services.mozilla.com/D209967

Differential Revision: https://phabricator.services.mozilla.com/D211031
This commit is contained in:
Andrew Creskey 2024-05-22 07:56:33 +00:00
parent 7e86c20b63
commit fad3d6c712

View file

@ -275,24 +275,7 @@ case "$target" in
;;
*-android*|*-linuxandroid*)
# From https://github.com/android-ndk/ndk/issues/133#issuecomment-308549264
# -Oz is smaller than -Os on clang.
MOZ_OPTIMIZE_FLAGS="-Oz"
# Disable the outliner, which causes performance regressions, and is
# enabled on some platforms at -Oz.
if test -z "$MOZ_LTO"; then
DISABLE_OUTLINER="-mno-outline"
_SAVE_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS $DISABLE_OUTLINER"
AC_TRY_COMPILE(,,[MOZ_OPTIMIZE_FLAGS="$MOZ_OPTIMIZE_FLAGS $DISABLE_OUTLINER"])
CFLAGS="$_SAVE_CFLAGS"
else
DISABLE_OUTLINER="-Wl,-plugin-opt=-enable-machine-outliner=never"
_SAVE_LDFLAGS=$LDFLAGS
LDFLAGS="$LDFLAGS $MOZ_LTO_LDFLAGS $DISABLE_OUTLINER"
AC_TRY_LINK(,,[MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS $DISABLE_OUTLINER"])
LDFLAGS="$_SAVE_LDFLAGS"
fi
MOZ_OPTIMIZE_FLAGS="-O2"
;;
*-*linux*)