1
0
mirror of https://github.com/BurntSushi/ripgrep.git synced 2025-11-23 21:54:45 +02:00

release: finally switch to LTO for release binaries

There seems to be a modest improvement on some workloads:

```
$ time rg -co '\w+' sixteenth.txt
158520346

real    8.457
user    8.426
sys     0.020
maxmem  779 MB
faults  0

$ time rg-lto -co '\w+' sixteenth.txt
158520346

real    8.200
user    8.178
sys     0.012
maxmem  778 MB
faults  0
```

I've somewhat reversed course on my previous thoughts here. The
improvement isn't much, but the hit to compile times in CI isn't
terrible. Mostly I'm doing this out of "good sense," and I think it's
generally unlikely to make it more difficult for me to diagnose
performance problems. (Since I still use the default `release` profile
locally, since it's about an order of magnitude quicker to compile.)

Ref #325, Ref #413, Ref #1187, Ref #1255
This commit is contained in:
Andrew Gallant
2025-10-15 22:45:20 -04:00
parent 79d393a302
commit 4c953731c4
2 changed files with 4 additions and 8 deletions

View File

@@ -176,11 +176,11 @@ jobs:
- name: Build release binary
shell: bash
run: |
${{ env.CARGO }} build --verbose --release --features pcre2 ${{ env.TARGET_FLAGS }}
${{ env.CARGO }} build --verbose --profile release-lto --features pcre2 ${{ env.TARGET_FLAGS }}
if [[ "${{ matrix.os }}" == windows-* ]]; then
bin="target/${{ matrix.target }}/release/rg.exe"
bin="target/${{ matrix.target }}/release-lto/rg.exe"
else
bin="target/${{ matrix.target }}/release/rg"
bin="target/${{ matrix.target }}/release-lto/rg"
fi
echo "BIN=$bin" >> $GITHUB_ENV

View File

@@ -86,12 +86,8 @@ panic = "abort"
incremental = false
codegen-units = 1
# This is the main way to strip binaries in the deb package created by
# 'cargo deb'. For other release binaries, we (currently) call 'strip'
# explicitly in the release process.
[profile.deb]
inherits = "release"
debug = false
inherits = "release-lto"
[package.metadata.deb]
features = ["pcre2"]