Skip to content

Commit cc5a3a7

Browse files
authored
chore: Cleanup Cargo profiles (#21214)
## Which issue does this PR close? - N/A ## Rationale for this change * Don't explicitly set default values when configuring profiles. For example, `release-nonlto` explicitly set several build settings (e.g., `opt_level`, `overflow_checks`) to their default values, which could be misleading. * Fix typos, reorder profile configuration, and other general cleanup No functional changes. ## What changes are included in this PR? ## Are these changes tested? Yes. ## Are there any user-facing changes? No.
1 parent e57198a commit cc5a3a7

File tree

1 file changed

+23
-33
lines changed

1 file changed

+23
-33
lines changed

Cargo.toml

Lines changed: 23 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -224,62 +224,57 @@ unused_qualifications = "deny"
224224
# --------------------
225225
# Compilation Profiles
226226
# --------------------
227-
# A Cargo profile is a preset for the compiler/linker knobs that trade off:
227+
# A Cargo profile is a preset for the compiler/linker knobs that trades off:
228228
# - Build time: how quickly code compiles and links
229229
# - Runtime performance: how fast the resulting binaries execute
230230
# - Binary size: how large the executables end up
231231
# - Debuggability: how much debug information is preserved for debugging and profiling
232232
#
233+
# To use a profile: `cargo [ build | run | ... ] --profile <profile-name>`
234+
#
233235
# Profiles available:
234-
# - dev: default debug build; fastest to compile, slowest to run, full debug info
235-
# for everyday development.
236-
# Run: cargo run
237-
# - release: optimized build; slowest to compile, fastest to run, smallest
238-
# binaries for public releases.
239-
# Run: cargo run --release
240-
# - release-nonlto: skips LTO, so it builds quicker while staying close to
241-
# release performance. It is useful when developing performance optimizations.
242-
# Run: cargo run --profile release-nonlto
236+
# - dev: default debug build; fastest to compile, slowest to run, full debug info.
237+
# For everyday development; default for "cargo [ build | test | run ]".
238+
# - release: fully optimized build; slowest to compile, fastest to run, smallest
239+
# binaries. For public releases; default for "cargo [ bench | install ]".
240+
# - release-nonlto: skips LTO, so it builds much faster while staying close to
241+
# release performance. Useful when developing performance optimizations.
243242
# - profiling: inherits release optimizations but retains debug info to support
244243
# profiling tools and flamegraphs.
245-
# Run: cargo run --profile profiling
246-
# - ci: derived from `dev` but disables incremental builds and strips dependency
247-
# symbols to keep CI artifacts small and reproducible.
248-
# Run: cargo run --profile ci
249-
# - ci-optimized: derived from `release` but enables debug assertions, and uses
250-
# lighter optimizations. Used for long-running CI tasks.
251-
# Run: cargo run --profile ci-release
244+
# - ci: derived from `dev` but disables debug info and incremental builds to keep
245+
# CI artifacts small and reproducible.
246+
# - ci-optimized: derived from `release` but enables debug assertions and uses
247+
# less aggressive optimizations for faster builds. Used for long-running CI
248+
# tasks.
252249
#
253250
# If you want to optimize compilation, the `compile_profile` benchmark can be useful.
254251
# See `benchmarks/README.md` for more details.
255252
[profile.release]
256253
codegen-units = 1
257254
lto = true
258-
strip = true # Eliminate debug information to minimize binary size
255+
strip = true # Eliminate debug info to minimize binary size
259256

260257
[profile.release-nonlto]
261-
codegen-units = 16
262-
debug-assertions = false
263-
incremental = false
264258
inherits = "release"
259+
codegen-units = 16
265260
lto = false
266-
opt-level = 3
267-
overflow-checks = false
268-
rpath = false
269-
strip = false # Retain debug info for flamegraphs
261+
strip = false # Retain debug info for flamegraphs
262+
263+
[profile.profiling]
264+
inherits = "release"
265+
debug = true
266+
strip = false
270267

271268
[profile.ci-optimized]
272269
inherits = "release"
273270
debug-assertions = true
274271
codegen-units = 16
275272
lto = "thin"
276-
strip = true
277273

278274
[profile.ci]
279-
debug = false
280275
inherits = "dev"
276+
debug = false
281277
incremental = false
282-
debug-assertions = true
283278

284279
# This rule applies to every package except workspace members (dependencies
285280
# such as `arrow` and `tokio`). It disables debug info and related features on
@@ -289,8 +284,3 @@ debug = false
289284
debug-assertions = false
290285
strip = "debuginfo"
291286
incremental = false
292-
293-
[profile.profiling]
294-
inherits = "release"
295-
debug = true
296-
strip = false

0 commit comments

Comments
 (0)