Skip to content

Commit

Permalink
Enable link-time optimization for Vim in MacVim CI builds
Browse files Browse the repository at this point in the history
From local profiling, enabling LTO for Vim gives a small but measurable
improvement to performance. One test that I did was to open a really
large Markdown file with vim-markdown (which usually chokes at large
files) installed, and measure how long that takes. With LTO turned on,
usually it gives at least 6-10% performance boost, which seems
significant enough to justify turning it on as we essentially get the
improvement for free (I didn't see similar boosts in other benhcmarking
I did though, so it depends). Slight caveat is that the binary size sees
a small increase (presumably due to inlining) but it's not too much. It
takes more time to build with this turned on though, so only do this in
CI, for the publish builds (we don't do this for the other runs in the
matrix so those runs can finish faster to provide timely feedbacks).

This doesn't change the compilation/linking options for MacVim binary
itself as that doesn't seem to be where performance caps are.
  • Loading branch information
ychin committed Oct 15, 2022
1 parent 6500a0c commit 88d7dd5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/ci-macvim.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,12 @@ jobs:
sed -i.bak -f ci/config.mk.clang-12.sed src/auto/config.mk
fi
if ${{ matrix.publish == true }}; then
# Only do link-time optimizations for publish builds, so the other
# ones can still finish quickly to give quick feedbacks.
sed -i.bak -f ci/config.mk.lto.sed src/auto/config.mk
fi
- name: Modify configure result
if: matrix.publish
run: |
Expand Down
3 changes: 3 additions & 0 deletions ci/config.mk.lto.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/$/ -flto/
/^LDFLAGS[[:blank:]]*=/s/$/ -flto/

0 comments on commit 88d7dd5

Please sign in to comment.