Skip to content

Commit fc44fca

Browse files
author
Devdutt Shenoi
authored
perf: do FAT LTO and singular codegen-unit on release (#970)
Optimize release builds by building them in a special profile release-lto that: - Enables FAT LTO - Uses codegen-unit = 1 This is intended to improve the quality of parseable binary compiled at release, in terms of performance and size. Fixes #224 .
1 parent f1af947 commit fc44fca

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

.github/workflows/release.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ jobs:
3737
with:
3838
use-cross: true
3939
command: build
40-
args: --release --target ${{matrix.target}}
40+
args: --profile release-lto --target ${{matrix.target}}
4141

4242
- name: Rename binary
4343
run: |
44-
mv target/${{ matrix.target }}/release/parseable Parseable_OSS_${{ matrix.target }}
44+
mv target/${{ matrix.target }}/release-lto/parseable Parseable_OSS_${{ matrix.target }}
4545
4646
- name: Generate artifact attestation
4747
uses: actions/attest-build-provenance@v1
@@ -82,11 +82,11 @@ jobs:
8282
override: true
8383

8484
- name: Build
85-
run: cargo build --all --release --target x86_64-pc-windows-msvc
85+
run: cargo build --all --profile release-lto --target x86_64-pc-windows-msvc
8686

8787
- name: Rename binary
8888
run: |
89-
mv target/x86_64-pc-windows-msvc/release/PARSEABLE.exe Parseable_OSS_x86_64-pc-windows-msvc.exe
89+
mv target/x86_64-pc-windows-msvc/release-lto/PARSEABLE.exe Parseable_OSS_x86_64-pc-windows-msvc.exe
9090
9191
- name: Generate artifact attestation
9292
uses: actions/attest-build-provenance@v1
@@ -135,12 +135,12 @@ jobs:
135135

136136
- name: Build
137137
run: |
138-
cargo build --release --target ${{ matrix.target }}
139-
strip target/${{ matrix.target }}/release/Parseable
138+
cargo build --profile release-lto --target ${{ matrix.target }}
139+
strip target/${{ matrix.target }}/release-lto/Parseable
140140
141141
- name: Rename binary
142142
run: |
143-
mv target/${{ matrix.target }}/release/Parseable Parseable_OSS_${{ matrix.target }}
143+
mv target/${{ matrix.target }}/release-lto/Parseable Parseable_OSS_${{ matrix.target }}
144144
145145
- name: Generate artifact attestation
146146
uses: actions/attest-build-provenance@v1

Cargo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,3 +127,8 @@ assets-sha1 = "9d5a45f204d709a2dd96f6a5e0b21b3834ee0e36"
127127

128128
[features]
129129
debug = []
130+
131+
[profile.release-lto]
132+
inherits = "release"
133+
lto = "fat"
134+
codegen-units = 1

0 commit comments

Comments
 (0)