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

Make seq return a ListStream where possible #7367

Merged
merged 2 commits into from
Dec 7, 2022

Conversation

merelymyself
Copy link
Contributor

Description

Title.

User-Facing Changes

Faster seq that works better with functions that take in ListStreams.

Tests + Formatting

Don't forget to add tests that cover your changes.

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 -- -D warnings -D clippy::unwrap_used -A clippy::needless_collect to check that you're using the standard code style
  • cargo test --workspace to check that all tests pass

After Submitting

If your PR had any user-facing changes, update the documentation after the PR is merged, if necessary. This will help us keep the docs up to date.

// everything had been generated; this does not work well with ListStreams.
// As such, the simple test is to check if this errors out: that means there is a float in the
// input, which necessarily means that parts of the output will be floats.
let rest_nums_check: Result<Vec<Spanned<i64>>, ShellError> = call.rest(engine_state, stack, 0);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm wondering if this has the same performance benefits of you last PR that you just closed related to this. I'm also wondering if calling call.rest() twice has some noticeable performance impact.

Copy link
Contributor

Choose a reason for hiding this comment

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

My gut feeling is that the performance impact of calling rest() twice will be negligible.

Copy link
Contributor

@rgwood rgwood left a comment

Choose a reason for hiding this comment

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

Looks like a solid improvement. Thank you!

@rgwood rgwood merged commit 3395bea into nushell:main Dec 7, 2022
@rgwood rgwood added the streaming Issues related to streaming data (or collecting data when it should be streamed) label Dec 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
streaming Issues related to streaming data (or collecting data when it should be streamed)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants