Skip to content

Commit

Permalink
Put heavy dataframe dependencies behind feature flag (nushell#9971)
Browse files Browse the repository at this point in the history
Context from Discord:
https://discord.com/channels/601130461678272522/615962413203718156/1138694933545504819

I was working on Nu for the first time in a while and I noticed that
sometimes rust-analyzer takes a really long time to run `cargo check` on
the entire workspace. I dug in and it was checking a bunch of
dataframe-related dependencies even though the `dataframe` feature is
not built by default.

It looks like this is a regression of sorts, introduced by
nushell#9241. Thankfully the fix is
pretty easy, we can make it so everything important in
`nu-cmd-dataframe` is only used when the `dataframe` feature is enabled.

### Impact on `cargo check --workspace`

Before this PR: 635 crates, 33.59s
After this PR: 498 crates, ~20s

(with the `mold` linker and a `cargo clean` before each run, the
relative difference for incremental checks will likely be much larger)
  • Loading branch information
rgwood committed Aug 10, 2023
1 parent f94df58 commit d5fa7b8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crates/nu-cmd-dataframe/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ optional = true
version = "0.30.0"

[features]
dataframe = ["default"]
default = ["num", "polars", "sqlparser"]
dataframe = ["num", "polars", "sqlparser"]
default = []

[dev-dependencies]
nu-cmd-lang = { path = "../nu-cmd-lang", version = "0.83.2" }
Expand Down
2 changes: 2 additions & 0 deletions crates/nu-cmd-dataframe/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
#[cfg(feature = "dataframe")]
pub mod dataframe;
#[cfg(feature = "dataframe")]
pub use dataframe::*;

0 comments on commit d5fa7b8

Please sign in to comment.