Skip to content

Commit 88d7dd5

Browse files
committed
Enable link-time optimization for Vim in MacVim CI builds
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.
1 parent 6500a0c commit 88d7dd5

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

.github/workflows/ci-macvim.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,12 @@ jobs:
137137
sed -i.bak -f ci/config.mk.clang-12.sed src/auto/config.mk
138138
fi
139139
140+
if ${{ matrix.publish == true }}; then
141+
# Only do link-time optimizations for publish builds, so the other
142+
# ones can still finish quickly to give quick feedbacks.
143+
sed -i.bak -f ci/config.mk.lto.sed src/auto/config.mk
144+
fi
145+
140146
- name: Modify configure result
141147
if: matrix.publish
142148
run: |

ci/config.mk.lto.sed

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Add link-time optimization for even better performance
2+
/^CFLAGS[[:blank:]]*=/s/$/ -flto/
3+
/^LDFLAGS[[:blank:]]*=/s/$/ -flto/

0 commit comments

Comments
 (0)