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

Add $nu.scope.engine_state #5739

Merged
merged 2 commits into from Jun 8, 2022
Merged

Add $nu.scope.engine_state #5739

merged 2 commits into from Jun 8, 2022

Conversation

kubouch
Copy link
Contributor

@kubouch kubouch commented Jun 8, 2022

Description

Adds a new $nu.scope.engine_state entry that includes the number of all inserted items in the engine state. It can be useful for tracking how the engine state grows over time.

Example output:

> $nu.scope.engine_state
  source_bytes   52951
  num_vars       421
  num_commands   339
  num_aliases    20
  num_blocks     371
  num_modules    9
  num_env_vars   220

Tests

Make sure you've run and fixed any issues with these commands:

  • cargo fmt --all -- --check to check standard code formatting (cargo fmt --all applies these changes)
  • cargo clippy --workspace --features=extra -- -D warnings -D clippy::unwrap_used -A clippy::needless_collect to check that you're using the standard code style
  • cargo test --workspace --features=extra to check that all the tests pass

@stormasm
Copy link
Contributor

stormasm commented Jun 8, 2022

This is a very nice cool addition ! 😃
Should definitely be useful for figuring out the size of things once we start adding very large data frames...

Actually maybe not...

If we have several large data frames in memory...
Are they inside the engine from a memory point of view ?

From a garbage collection point of view.
I guess we can not drop that data frame and clean up the memory...

@fdncred
Copy link
Collaborator

fdncred commented Jun 8, 2022

nice - i just reran the failed test and it passed this time.

@fdncred
Copy link
Collaborator

fdncred commented Jun 8, 2022

This looks fun. let's land and play. :)

@fdncred fdncred merged commit 5bae7e5 into nushell:main Jun 8, 2022
@fdncred
Copy link
Collaborator

fdncred commented Jun 8, 2022

we should have a contest to see who can make the biggest numbers without crashing nushell. here's my entry, which is just my standard load with nothing extra.
image

fennewald pushed a commit to fennewald/nushell that referenced this pull request Jun 27, 2022
* Add number of items present in engine state

* Rename num_decls column to num_commands
@kubouch kubouch deleted the scope branch July 14, 2022 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants