perf(build): use line-tables-only debug info in the dev profile - #24339
Merged
Conversation
`dev` is the profile behind every `cargo build` and `cargo test`, so its debug
info is generated over and over. `line-tables-only` keeps file and line numbers
-- panics and `RUST_BACKTRACE` output stay just as useful -- and drops the
variable-level DWARF that only an interactive debugger consumes.
Measured per crate, interleaved with the baseline so machine drift cancels out.
The flag is passed to the crate under test only, so cached dependency artifacts
stay valid and nothing else moves:
crate debug=2 line-tables-only
datafusion-physical-plan 8.89s 7.43s
datafusion-functions-aggregate 5.86s 4.63s
datafusion-physical-expr 4.57s 3.59s
datafusion-functions 4.64s 4.04s
datafusion-expr 4.54s 3.57s
datafusion-functions-nested 4.37s 3.06s
datafusion-optimizer 3.91s 3.12s
datafusion-common 3.73s 3.10s
datafusion-sql 3.57s 2.43s
datafusion-datasource-parquet 3.27s 2.44s
datafusion-datasource 1.90s 1.42s
datafusion-physical-optimizer 1.22s 0.99s
-------------------------------------------------------
sum 50.5s 39.8s (-21%)
The saving is codegen-side, as expected: `datafusion-catalog`, which spends its
time in the trait solver rather than in LLVM, moves only 7.4s -> 7.0s.
Artifacts shrink too -- `libdatafusion_physical_plan.rlib` goes from 141MB to
100MB.
Verified that backtraces keep their file and line numbers under the new setting:
thread 'main' panicked at datafusion/core/src/bin/print_functions_docs.rs:38:9
at ./datafusion/core/src/bin/print_functions_docs.rs:38:9
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
dev profiledev profile
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #24339 +/- ##
=======================================
Coverage 81.14% 81.14%
=======================================
Files 1112 1112
Lines 386933 386933
Branches 386933 386933
=======================================
+ Hits 313967 313976 +9
+ Misses 54476 54463 -13
- Partials 18490 18494 +4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
comphead
approved these changes
Aug 13, 2026
comphead
left a comment
Contributor
There was a problem hiding this comment.
Thanks @Dandandan makes sense for local builds.
Contributor
|
🚀 |
imtherealnaska
pushed a commit
to imtherealnaska/datafusion
that referenced
this pull request
Aug 16, 2026
…ache#24339) ## Which issue does this PR close? Adresses: apache#13814 Found while profiling compile times for apache#24325 / apache#24326 / apache#24329 / apache#24330, which removed the trait-solving cost from the four crates on the critical path and left LLVM as the dominant remaining cost. ## Rationale for this change `dev` is the profile behind every `cargo build` and `cargo test`, so its debug info is generated over and over. `debug = "line-tables-only"` keeps file and line numbers — panics and `RUST_BACKTRACE` output stay just as useful — and drops the variable-level DWARF that only an interactive debugger consumes. Measured per crate, **interleaved** with the baseline so machine drift cancels out. The flag is passed to the crate under test only, so cached dependency artifacts stay valid and nothing else moves between the two measurements: | crate | `debug = 2` | `line-tables-only` | | |---|---|---|---| | `datafusion-physical-plan` | 8.89s | 7.43s | −16% | | `datafusion-functions-aggregate` | 5.86s | 4.63s | −21% | | `datafusion-physical-expr` | 4.57s | 3.59s | −21% | | `datafusion-functions` | 4.64s | 4.04s | −13% | | `datafusion-expr` | 4.54s | 3.57s | −21% | | `datafusion-functions-nested` | 4.37s | 3.06s | −30% | | `datafusion-optimizer` | 3.91s | 3.12s | −20% | | `datafusion-common` | 3.73s | 3.10s | −17% | | `datafusion-sql` | 3.57s | 2.43s | −32% | | `datafusion-datasource-parquet` | 3.27s | 2.44s | −25% | | `datafusion-datasource` | 1.90s | 1.42s | −25% | | `datafusion-physical-optimizer` | 1.22s | 0.99s | −19% | | **sum** | **50.5s** | **39.8s** | **−21%** | The saving is codegen-side, as you would expect: `datafusion-catalog`, which spends its time in the trait solver rather than in LLVM, moves only 7.4s → 7.0s. Artifacts shrink as well — `libdatafusion_physical_plan.rlib` goes from **141MB to 100MB**. ## What changes are included in this PR? One setting on `[profile.dev]`, plus an update to the profile documentation block above it, which currently advertises "full debug info" for `dev`. ## Are these changes tested? ## Are there any user-facing changes? For anyone stepping through DataFusion in a debugger, local variable inspection needs `CARGO_PROFILE_DEV_DEBUG=2 cargo build` (or a local override in `.cargo/config.toml`); the comment in `Cargo.toml` says so. Everything else — panic locations, backtraces, `#[test]` failures — is unchanged. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Dandandan
added a commit
to emilk/datafusion
that referenced
this pull request
Aug 21, 2026
…nto 9 (apache#24342) ## Which issue does this PR close? None. Found while profiling compile times (apache#24325, apache#24326, apache#24329, apache#24330, apache#24338, apache#24339) — this is the largest remaining item I measured. ## Rationale for this change `datafusion-functions` declares **63 `[[bench]]` targets**. Each one is a separate binary that statically links this crate, arrow and criterion, so building the crate's benchmarks means 63 link steps. Linking, not compiling, is the bulk of it: rebuilding a **single** bench target takes **10.6s**, almost all of it link, while the 63 benchmark files together are only ~10.5k lines of source. This is paid by `cargo bench`, by `cargo build --all-targets`, and by CI's `clippy --all-targets`. ## What changes are included in this PR? The targets are grouped by their `required-features`, which preserves that semantics exactly — a group can only be built when its feature is on, just as each individual bench could before: | target | benches | required-features | |---|---|---| | `string_expressions` | 16 | `["string_expressions"]` | | `math_expressions` | 16 | `["math_expressions"]` | | `unicode_expressions` | 12 | `["unicode_expressions"]` | | `datetime_expressions` | 8 | `["datetime_expressions"]` | | `regex_expressions` | 4 | `["regex_expressions"]` | | `misc` | 4 | none | `crypto`, `encoding` and `dictionary_encoding` stay standalone — they are the only members of their feature groups, so grouping them would buy nothing. Each group lives in its own directory, `benches/<group>/`, with `main.rs` declaring the individual benchmarks as modules and listing their criterion groups in a single `criterion_main!`. Cargo does not auto-discover targets inside those directories, so no `autobenches = false` is needed — which also keeps `cargo machete` working (it stops scanning `benches/` when autodiscovery is disabled). `benches/helper.rs` stays shared at the top level, reached with `#[path = "../helper.rs"]`. **The benchmark code itself is untouched.** There is not a single change to a `bench_function`, `benchmark_group` or `bench_with_input` line anywhere in the diff — git reports every moved file as a 94–99% similarity rename. Per file the change is only: - drop `criterion_main!` — a module cannot define `main` - drop the now-unused `criterion_main` import - drop `extern crate criterion` (a no-op since edition 2018, present in 4 files) - point the four users of `benches/helper.rs` at `crate::helper` ## Are these changes tested? Interleaved with `main` so machine drift cancels out: | `cargo clean -p datafusion-functions` then… | main | this PR | |---|---|---| | `cargo build --benches` | 43.9s / 42.9s | **28.4s / 28.3s** | | `cargo check --benches` | 15.0s / 14.7s | **12.9s / 12.8s** | Every benchmark still runs, and the counts show nothing was dropped: | target | benchmarks (`-- --test`) | |---|---| | `string_expressions` | 252 | | `unicode_expressions` | 251 | | `datetime_expressions` | 103 | | `dictionary_encoding` | 36 | | `regex_expressions` | 27 | | `misc` | 21 | | `encoding` | 9 | | `crypto` | 10 (with `--features crypto_expressions`) | Also clean: `cargo clippy -p datafusion-functions --all-targets`, `cargo fmt --check`, and `cargo machete --with-metadata`. Filtering a single benchmark still works — `cargo bench --bench math_expressions -- power` selects exactly one. `cargo metadata` reports 10 bench targets, against 64 on `main`; both counts include the auto-discovered `helper`, which is unchanged by this PR. ## Are there any user-facing changes? Only for running an individual benchmark. Where you would previously write ``` cargo bench -p datafusion-functions --bench lower ``` you now select the group and filter by name: ``` cargo bench -p datafusion-functions --bench string_expressions -- lower ``` The filter is criterion's own, matching on benchmark id, so it also narrows to a single case within a benchmark. No library changes. If this approach looks right, roughly 100 more bench targets across the other crates could get the same treatment — I did this one crate first so the tradeoff is visible on a real diff before it spreads. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5 <noreply@anthropic.com> Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
Member
|
I wasted so much time trying to figure out why in debugger when running test I could not see the variables 😢 setting the env var for this project only is not that convenient unfortunately |
jayzhan211
pushed a commit
to jayzhan211/datafusion
that referenced
this pull request
Sep 6, 2026
## Which issue does this PR close? - Closes None ## Rationale for this change Since apache#24339, the debugging behavior has changed, and variables are no longer included in the debugging output by default. This PR adds a section to the contributor documentation explaining how to enable variable output during debugging. ## What changes are included in this PR? See above. ## What is the testing strategy for this PR? Only doc changes. ## Are there any user-facing changes? No.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
Adresses: #13814
Found while profiling compile times for #24325 / #24326 / #24329 / #24330,
which removed the trait-solving cost from the four crates on the critical path
and left LLVM as the dominant remaining cost.
Rationale for this change
devis the profile behind everycargo buildandcargo test, so its debuginfo is generated over and over.
debug = "line-tables-only"keeps file and linenumbers — panics and
RUST_BACKTRACEoutput stay just as useful — and drops thevariable-level DWARF that only an interactive debugger consumes.
Measured per crate, interleaved with the baseline so machine drift cancels
out. The flag is passed to the crate under test only, so cached dependency
artifacts stay valid and nothing else moves between the two measurements:
debug = 2line-tables-onlydatafusion-physical-plandatafusion-functions-aggregatedatafusion-physical-exprdatafusion-functionsdatafusion-exprdatafusion-functions-nesteddatafusion-optimizerdatafusion-commondatafusion-sqldatafusion-datasource-parquetdatafusion-datasourcedatafusion-physical-optimizerThe saving is codegen-side, as you would expect:
datafusion-catalog, whichspends its time in the trait solver rather than in LLVM, moves only 7.4s → 7.0s.
Artifacts shrink as well —
libdatafusion_physical_plan.rlibgoes from 141MBto 100MB.
What changes are included in this PR?
One setting on
[profile.dev], plus an update to the profile documentation blockabove it, which currently advertises "full debug info" for
dev.Are these changes tested?
Are there any user-facing changes?
For anyone stepping through DataFusion in a debugger, local variable inspection
needs
CARGO_PROFILE_DEV_DEBUG=2 cargo build(or a local override in.cargo/config.toml); the comment inCargo.tomlsays so. Everything else —panic locations, backtraces,
#[test]failures — is unchanged.🤖 Generated with Claude Code