Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use -O3 and link-time-optimization for published builds #1444

Merged
merged 1 commit into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 24 additions & 6 deletions .github/workflows/ci-macvim.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ env:

CC: clang

MAKE_BUILD_ARGS: LINK_AS_NEEDED=yes # In macOS we never over-specify link dependencies and we already check against external deps in smoketest. With LTO, linking takes a while, so we want to avoid using link.sh.

VERSIONER_PERL_VERSION: '5.30' # macOS default Perl installation uses this to determine which one to use

vi_cv_path_python: /Library/Frameworks/Python.framework/Versions/2.7/bin/python
Expand Down Expand Up @@ -186,6 +188,13 @@ jobs:
sed -i.bak -f ci/config.mk.clang-12.sed src/auto/config.mk
fi

if ${{ matrix.publish == true && ! matrix.legacy }}; then
# Only do O3/link-time optimizations for publish builds, so the other ones can still finish quickly to give
# quick feedbacks. Only do this for non-legacy builds now as it seems the older toolchain doesn't work as
# well for this.
sed -i.bak -f ci/config.mk.optimized.sed src/auto/config.mk
fi

- name: Modify configure result
if: matrix.publish
run: |
Expand All @@ -211,12 +220,11 @@ jobs:
env:
LC_ALL: C
run: |
set -o verbose

NPROC=$(getconf _NPROCESSORS_ONLN)
echo "Building MacVim with ${NPROC} cores"

make -j${NPROC}
set -o verbose
make ${MAKE_BUILD_ARGS} -j${NPROC}

- name: Check version
run: |
Expand Down Expand Up @@ -292,15 +300,25 @@ jobs:
make -C runtime/doc vimtags VIMEXE=../../${VIM_BIN}
git diff --exit-code -- runtime/doc/tags

- name: Build test binaries
run: |
# Build the unit test binaries first. With link-time-optimization they take some time to link. Running them
# separately de-couples them from the timeout in tests, and allow us to build in parallel jobs (since tests
# can't run in parallel).
NPROC=$(getconf _NPROCESSORS_ONLN)

set -o verbose
make ${MAKE_BUILD_ARGS} -j${NPROC} -C src unittesttargets

- name: Test
timeout-minutes: 20
run: make test
run: make ${MAKE_BUILD_ARGS} test

- name: Test GUI
timeout-minutes: 20
run: |
make -C src/testdir clean
make -C src testgui
make ${MAKE_BUILD_ARGS} -C src/testdir clean
make ${MAKE_BUILD_ARGS} -C src testgui

# Creates a DMG package of MacVim. Note that this doesn't create a GitHub release for us, because we would prefer to
# do it manually, for two reasons: 1) signing / notarization are currently done out of CI, 2) we want to manually
Expand Down
3 changes: 3 additions & 0 deletions ci/config.mk.optimized.sed
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Add link-time optimization for even better performance
/^CFLAGS[[:blank:]]*=/s/-O2/-O3 -flto/
/^LDFLAGS[[:blank:]]*=/s/$/ -flto/