feat: thin lto for non consuming artifacts - #2396
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ac022a4654
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| CARGO_PROFILE_RELEASE_LTO: "thin" | ||
| CARGO_PROFILE_RELEASE_CODEGEN_UNITS: "16" |
There was a problem hiding this comment.
Include the profile overrides in the Rust cache key
When the ffi job restores an existing main-branch cache, these variables are visible only to the later Generate step, so the preceding Swatinem/rust-cache action computes the same key as for the fat-LTO configuration. Cargo then invalidates and rebuilds the restored release artifacts, while the immutable exact-key cache prevents the newly built thin-LTO artifacts from replacing them; consequently subsequent runs can repeatedly rebuild the dependency graph and lose the intended speedup. Put these overrides at job scope or otherwise incorporate them into the cache key.
Useful? React with 👍 / 👎.
🎉 All green!🧪 All tests passed 🎯 Code Coverage (details) 🔗 Commit SHA: ac022a4 | Docs | View more details | Give us feedback! |
BenchmarksComparisonBenchmark execution time: 2026-08-24 13:21:12 Comparing candidate commit ac022a4 in PR branch Found 1 performance improvements and 5 performance regressions! Performance is the same for 146 metrics, 0 unstable metrics.
|
Artifact Size Benchmark Reportaarch64-alpine-linux-musl
aarch64-unknown-linux-gnu
libdatadog-x64-windows
libdatadog-x86-windows
x86_64-alpine-linux-musl
x86_64-unknown-linux-gnu
|
| CARGO_PROFILE_RELEASE_LTO: "thin" | ||
| CARGO_PROFILE_RELEASE_CODEGEN_UNITS: "16" |
There was a problem hiding this comment.
Instead of hardcoding these values in the workflow files we could setup a profile for the CI in the Cargo.toml the downside is that you would need to include some plumbering in the builder crate in order to pass the profile. That way we could reuse that profile in libdatadog, libddprof-build and also downstream projects that use the builder. Wdyt? It can be done in a subsequent PR if you want to test this approach first.
Also another advantage is that you can include the profile in the cache key rather than manually setting them depending on the job.
Fat LTO + codegen-units=1 makes the Generate profiling FFI step slow for no reason, this doesn't ship an artifact anyone consumes. Override to thin LTO / codegen-units=16 via CARGO_PROFILE_RELEASE_* env vars for this build only