nushell / nushell/nushell

Significant overhead with even super simple scripts

Open
#10,312 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

performance status:needs-triage
Dominant language
Rust
Stars
40.5k
Forks
2.3k
Avg merge
1d 19h
Merged PRs (30d)
85

Description

Describe the bug

When running an incredibly simple script, it seems to have significant overhead.

The script (see "How to reproduce") takes significant amounts of time to run (tested with both timeit and time, running with nu command and without):

$ time nu ./example.nu world                                                                                                                                                                 09/11/2023 08:48:04 AM
Hello, world!
0.06user 0.02system 0:00.08elapsed 98%CPU (0avgtext+0avgdata 29788maxresident)k
96inputs+0outputs (0major+3054minor)pagefaults 0swaps
$ time ./example.nu world                                                                                                                                                                    09/11/2023 08:49:49 AM
Hello, world!
0.06user 0.01system 0:00.08elapsed 100%CPU (0avgtext+0avgdata 29792maxresident)k
0inputs+0outputs (0major+3039minor)pagefaults 0swaps
$ timeit nu ./example.nu world                                                                                                                                                               09/11/2023 08:48:55 AM
Hello, world!
62ms 979µs 294ns
$ timeit ./example.nu world                                                                                                                                                                  09/11/2023 08:48:39 AM
Hello, world!
83ms 369µs 401ns
How to reproduce

This is the script I used to test it:

#!/run/current-system/sw/bin/nu

def main [
  name: string
] {
  echo $"Hello, ($name)!";
}
Expected behavior

Near-instant parsing and evaluation, less then current timing.

Screenshots

No response

Configuration
key value
version 0.84.0
branch
commit_hash
build_os linux-x86_64
build_target x86_64-unknown-linux-gnu
rust_version rustc 1.71.1 (eb26296b5 2023-08-03) (built from a source tarball)
cargo_version cargo 1.71.1
build_time 1980-01-01 00:00:00 +00:00
build_rust_channel release
allocator standard
features dataframe, default, extra, sqlite, trash, which, zip
installed_plugins
Additional context

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 by reproducing the reported timings for the minimal example.nu script with both nu ./example.nu world and direct execution, then profile startup, parsing, and evaluation to identify the overhead. Done means demonstrating a measured reduction in startup time while preserving the script's output and behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, shell
Domain
cli, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.