This is an automated email from the ASF dual-hosted git repository. hgruszecki pushed a commit to branch optimize-dev-build in repository https://gitbox.apache.org/repos/asf/iggy.git
commit 3c5c5758aa4c8fda945849e25842ac3f5774711b Author: Hubert Gruszecki <[email protected]> AuthorDate: Fri Jan 30 14:08:58 2026 +0100 perf(ci): optimize hot dependencies in dev profile Add opt-level=3 for CPU-intensive dependencies: - argon2: password hashing - twox-hash: checksum calculation - rand_chacha: random number generation - iggy_common: wrapper functions for above This approach should be faster than global opt-level=1 which takes ~14 min on GitHub workers without cache. By selectively optimizing only hot paths, we reduce build+test CPU time without the compilation overhead of optimizing the entire dependency tree. --- .github/actions/rust/pre-merge/action.yml | 29 ++++++++++++++++++++--------- .github/workflows/_common.yml | 20 -------------------- .github/workflows/_detect.yml | 2 -- .github/workflows/_test.yml | 2 -- .github/workflows/_test_bdd.yml | 2 -- .github/workflows/_test_examples.yml | 2 -- .github/workflows/pre-merge.yml | 3 --- Cargo.toml | 16 ++++++++++++++-- scripts/check-backwards-compat.sh | 4 ++-- 9 files changed, 36 insertions(+), 44 deletions(-) diff --git a/.github/actions/rust/pre-merge/action.yml b/.github/actions/rust/pre-merge/action.yml index dc08d8d78..4d91efc8a 100644 --- a/.github/actions/rust/pre-merge/action.yml +++ b/.github/actions/rust/pre-merge/action.yml @@ -104,11 +104,17 @@ runs: - name: Build and test if: inputs.task == 'test' run: | - build_start=$(date +%s) - cargo build --locked --all-targets - build_end=$(date +%s) - build_duration=$((build_end - build_start)) - echo "::notice::Build completed in ${build_duration}s ($(date -ud @${build_duration} +'%M:%S'))" + bins_start=$(date +%s) + cargo build --locked --bins --libs + bins_end=$(date +%s) + bins_duration=$((bins_end - bins_start)) + echo "::notice::Binaries and libraries built in ${bins_duration}s ($(date -ud @${bins_duration} +'%M:%S'))" + + compile_start=$(date +%s) + cargo test --locked --no-run + compile_end=$(date +%s) + compile_duration=$((compile_end - compile_start)) + echo "::notice::Tests compiled in ${compile_duration}s ($(date -ud @${compile_duration} +'%M:%S'))" test_start=$(date +%s) if command -v cargo-nextest &> /dev/null; then @@ -118,13 +124,18 @@ runs: fi test_end=$(date +%s) test_duration=$((test_end - test_start)) - echo "::notice::Tests completed in ${test_duration}s ($(date -ud @${test_duration} +'%M:%S'))" + echo "::notice::Tests executed in ${test_duration}s ($(date -ud @${test_duration} +'%M:%S'))" + build_duration=$((bins_duration + compile_duration)) + total_duration=$((build_duration + test_duration)) echo "" echo "=========================================" - echo "Build time: ${build_duration}s ($(date -ud @${build_duration} +'%M:%S'))" - echo "Test time: ${test_duration}s ($(date -ud @${test_duration} +'%M:%S'))" - echo "Total time: $((build_duration + test_duration))s ($(date -ud @$((build_duration + test_duration)) +'%M:%S'))" + echo "Binaries and libraries build: ${bins_duration}s ($(date -ud @${bins_duration} +'%M:%S'))" + echo "Tests compile: ${compile_duration}s ($(date -ud @${compile_duration} +'%M:%S'))" + echo "Tests execute: ${test_duration}s ($(date -ud @${test_duration} +'%M:%S'))" + echo "-----------------------------------------" + echo "Total build: ${build_duration}s ($(date -ud @${build_duration} +'%M:%S'))" + echo "Total time: ${total_duration}s ($(date -ud @${total_duration} +'%M:%S'))" echo "=========================================" shell: bash diff --git a/.github/workflows/_common.yml b/.github/workflows/_common.yml index 4cca1ea0b..32d624a4b 100644 --- a/.github/workflows/_common.yml +++ b/.github/workflows/_common.yml @@ -33,8 +33,6 @@ jobs: rust-versions: name: Check Rust versions sync runs-on: ubuntu-latest - env: - IGGY_CI_BUILD: true steps: - uses: actions/checkout@v4 @@ -45,8 +43,6 @@ jobs: name: Check PR Title if: github.event_name == 'pull_request' && !inputs.skip_pr_title runs-on: ubuntu-latest - env: - IGGY_CI_BUILD: true steps: - name: Validate PR Title uses: amannn/action-semantic-pull-request@v5 @@ -107,8 +103,6 @@ jobs: license-headers: name: Check license headers runs-on: ubuntu-latest - env: - IGGY_CI_BUILD: true steps: - uses: actions/checkout@v4 @@ -127,8 +121,6 @@ jobs: license-list: name: Check licenses list runs-on: ubuntu-latest - env: - IGGY_CI_BUILD: true steps: - uses: actions/checkout@v4 @@ -145,8 +137,6 @@ jobs: markdown: name: Markdown lint runs-on: ubuntu-latest - env: - IGGY_CI_BUILD: true steps: - uses: actions/checkout@v4 @@ -164,8 +154,6 @@ jobs: shellcheck: name: Shell scripts lint runs-on: ubuntu-latest - env: - IGGY_CI_BUILD: true steps: - name: Checkout code uses: actions/checkout@v4 @@ -182,8 +170,6 @@ jobs: trailing-whitespace: name: Check trailing whitespace runs-on: ubuntu-latest - env: - IGGY_CI_BUILD: true steps: - name: Checkout code uses: actions/checkout@v4 @@ -196,8 +182,6 @@ jobs: trailing-newline: name: Check trailing newline runs-on: ubuntu-latest - env: - IGGY_CI_BUILD: true steps: - name: Checkout code uses: actions/checkout@v4 @@ -210,8 +194,6 @@ jobs: toml-format: name: Check TOML formatting runs-on: ubuntu-latest - env: - IGGY_CI_BUILD: true steps: - name: Checkout code uses: actions/checkout@v4 @@ -243,8 +225,6 @@ jobs: ] if: always() runs-on: ubuntu-latest - env: - IGGY_CI_BUILD: true steps: - name: Summary run: | diff --git a/.github/workflows/_detect.yml b/.github/workflows/_detect.yml index 0d11c5e3d..8fe50c889 100644 --- a/.github/workflows/_detect.yml +++ b/.github/workflows/_detect.yml @@ -51,8 +51,6 @@ on: jobs: detect: runs-on: ubuntu-latest - env: - IGGY_CI_BUILD: true outputs: rust_matrix: ${{ steps.mk.outputs.rust_matrix }} python_matrix: ${{ steps.mk.outputs.python_matrix }} diff --git a/.github/workflows/_test.yml b/.github/workflows/_test.yml index e40429bc5..b1e3ac67e 100644 --- a/.github/workflows/_test.yml +++ b/.github/workflows/_test.yml @@ -41,8 +41,6 @@ jobs: 'ubuntu-latest' }} timeout-minutes: 60 - env: - IGGY_CI_BUILD: true steps: - name: Checkout code uses: actions/checkout@v4 diff --git a/.github/workflows/_test_bdd.yml b/.github/workflows/_test_bdd.yml index dbba0b26d..cfa2e2188 100644 --- a/.github/workflows/_test_bdd.yml +++ b/.github/workflows/_test_bdd.yml @@ -36,8 +36,6 @@ jobs: run: runs-on: ubuntu-latest timeout-minutes: 60 - env: - IGGY_CI_BUILD: true steps: - name: Cleanup disk space run: | diff --git a/.github/workflows/_test_examples.yml b/.github/workflows/_test_examples.yml index 492239cf4..0de6c5fa3 100644 --- a/.github/workflows/_test_examples.yml +++ b/.github/workflows/_test_examples.yml @@ -35,8 +35,6 @@ jobs: run: runs-on: ubuntu-latest timeout-minutes: 60 - env: - IGGY_CI_BUILD: true steps: - name: Checkout code uses: actions/checkout@v4 diff --git a/.github/workflows/pre-merge.yml b/.github/workflows/pre-merge.yml index 0215afe3a..98627b9dd 100644 --- a/.github/workflows/pre-merge.yml +++ b/.github/workflows/pre-merge.yml @@ -21,9 +21,6 @@ on: branches: [master] workflow_dispatch: -env: - IGGY_CI_BUILD: true - concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} diff --git a/Cargo.toml b/Cargo.toml index e6797945c..b8c8e4594 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -248,5 +248,17 @@ zip = { version = "7.2.0", default-features = false, features = ["deflate"] } lto = true codegen-units = 1 -[profile.dev] -opt-level = 1 +# [profile.dev] +# opt-level = 1 + +[profile.dev.package.argon2] +opt-level = 3 + +[profile.dev.package.twox-hash] +opt-level = 3 + +[profile.dev.package.rand_chacha] +opt-level = 3 + +[profile.dev.package.iggy_common] +opt-level = 3 diff --git a/scripts/check-backwards-compat.sh b/scripts/check-backwards-compat.sh index 470c6f300..d49cfb78b 100755 --- a/scripts/check-backwards-compat.sh +++ b/scripts/check-backwards-compat.sh @@ -163,7 +163,7 @@ ok "worktree at $MASTER_DIR" pushd "$MASTER_DIR" >/dev/null info "Building iggy-server & benches (baseline: $MASTER_REF)" -IGGY_CI_BUILD=true cargo build --bins +cargo build --locked --bin iggy-server --bin iggy-bench ok "built baseline" info "Starting iggy-server (baseline)" @@ -220,7 +220,7 @@ git rev-parse --verify "$PR_REF^{commit}" >/dev/null 2>&1 || die "PR_REF '$PR_RE git checkout -q "$PR_REF" info "Building iggy-server & benches (PR: $PR_REF)" -IGGY_CI_BUILD=true cargo build --bins +cargo build --locked --bin iggy-server --bin iggy-bench ok "built PR" info "Restoring baseline local_data/ into PR workspace"
