nushell / nushell/nushell

Potential performance improvements of the parser: delay type widening in `parse_list_expression` and `parse_table_expression`

Open
#17,776 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

category:enhancement status:needs-triage
Dominant language
Rust
Stars
40.5k
Forks
2.3k
Avg merge
1d 14h
Merged PRs (30d)
79

Description

Basics
  • I have done a basic search through the issue tracker to find similar or related issues.
  • I have made myself familiar with the available features of Nushell for the particular area this enhancement request touches.
Related problem

let foo: list<any> = [1 2 3 a b c] currently triggers type widening when parsing the list expression, then the widened list<oneof<int, string>> is abandoned because there's an explicit type annotation list<any> in the assignment.

I would say most of the widened types are useless, and should only be computed when being checked against something non-trivial.

Describe the solution you'd like

https://github.com/nushell/nushell/pull/17575#issuecomment-4017986692

That strategy seems better suited for new-nu-parser.
Nu-parser probably needs more tweaks.

Describe alternatives you've considered

No response

Additional context and details

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with parse_list_expression and parse_table_expression in the Nu-parser and new-nu-parser implementations, then read the strategy discussed in PR #17575. Determine how explicit annotations such as list should avoid unnecessary type widening, and verify that the resulting parser behavior matches the intended deferred-checking strategy.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli, compilers
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.