Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Break up interdependencies of command crates #9429

Merged
merged 4 commits into from Jun 14, 2023

Conversation

sholderbach
Copy link
Member

Description

Make sure that our different crates that contain commands can be compiled in parallel.
This can under certain circumstances accelerate the compilation with sufficient multithreading available.

Details

  • Move help commands from nu-cmd-lang back to nu-command
    • This also makes sense as the commands are implemented in an ANSI-terminal specific way
  • Make nu-cmd-lang only a dev dependency for nu-command
  • Change context creation helpers for nu-cmd-extra and nu-cmd-dataframe to have a consistent api used in src/main.rs:get_engine_state()
  • nu-command now indepedent from nu-cmd-extra and nu-cmd-dataframe that are now dependencies of nu directly. (change to internal features)
  • Fix tests that previously used nu-command::create_default_context() with replacement functions

From scratch compilation times:

just debug (dev) build and default features

cargo clean --profile dev && cargo build --timings

before

grafik

after

grafik

User-Facing Changes

None direct, only change to compilation on multithreaded jobs expected.

Tests + Formatting

Tests that previously chose to use nu-command for their scope will still use nu-cmd-lang + nu-command (command list in the granularity at the time)

- Move `help` commands from `nu-cmd-lang` back to `nu-command`
- Make `nu-cmd-lang` only a dev dependency for `nu-command`
- Change context creation helpers for `nu-cmd-extra` and
`nu-cmd-dataframe` to have a consistent api used in
`src/main.rs`:`get_engine_state()`
- `nu-command` now indepedent from `nu-cmd-extra` and `nu-cmd-dataframe`
that are now dependencies of `nu` directly. (change to internal features)
- Fix tests that previously used `nu-command::create_default_context()`
with replacement functions
Move `nu-cmd-lang` to dev-dependencies as no longer needed for the crate
function only relevant in tests.
@sholderbach
Copy link
Member Author

With the feature extra enabled the savings are > 3 sec on 8 logical threads and >10 sec when compiling with the feature dataframe.

Copy link
Member

@amtoine amtoine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think this looks great and yet another step in the right direction, thanks @sholderbach 😊

@sholderbach sholderbach merged commit 46eebc6 into nushell:main Jun 14, 2023
16 checks passed
@sholderbach sholderbach deleted the command-para branch June 14, 2023 21:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants