Skip to content

Commit

Permalink
perf: do FAT LTO and singular codegen-unit on release (#970)
Browse files Browse the repository at this point in the history
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 .
  • Loading branch information
de-sh authored Dec 17, 2024
1 parent f1af947 commit fc44fca
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ jobs:
with:
use-cross: true
command: build
args: --release --target ${{matrix.target}}
args: --profile release-lto --target ${{matrix.target}}

- name: Rename binary
run: |
mv target/${{ matrix.target }}/release/parseable Parseable_OSS_${{ matrix.target }}
mv target/${{ matrix.target }}/release-lto/parseable Parseable_OSS_${{ matrix.target }}
- name: Generate artifact attestation
uses: actions/attest-build-provenance@v1
Expand Down Expand Up @@ -82,11 +82,11 @@ jobs:
override: true

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

- name: Rename binary
run: |
mv target/x86_64-pc-windows-msvc/release/PARSEABLE.exe Parseable_OSS_x86_64-pc-windows-msvc.exe
mv target/x86_64-pc-windows-msvc/release-lto/PARSEABLE.exe Parseable_OSS_x86_64-pc-windows-msvc.exe
- name: Generate artifact attestation
uses: actions/attest-build-provenance@v1
Expand Down Expand Up @@ -135,12 +135,12 @@ jobs:

- name: Build
run: |
cargo build --release --target ${{ matrix.target }}
strip target/${{ matrix.target }}/release/Parseable
cargo build --profile release-lto --target ${{ matrix.target }}
strip target/${{ matrix.target }}/release-lto/Parseable
- name: Rename binary
run: |
mv target/${{ matrix.target }}/release/Parseable Parseable_OSS_${{ matrix.target }}
mv target/${{ matrix.target }}/release-lto/Parseable Parseable_OSS_${{ matrix.target }}
- name: Generate artifact attestation
uses: actions/attest-build-provenance@v1
Expand Down
5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,8 @@ assets-sha1 = "9d5a45f204d709a2dd96f6a5e0b21b3834ee0e36"

[features]
debug = []

[profile.release-lto]
inherits = "release"
lto = "fat"
codegen-units = 1

0 comments on commit fc44fca

Please sign in to comment.