nushell: Slow startup when openings nushell for the first time

Describe the bug

I am experiencing a slow startup when I open Nushell for the first time. I don’t know how to debug the issue.

The issue is due to slow plugging registration: https://github.com/nushell/nushell/issues/4050#issuecomment-930398852

How to reproduce

This is my config file:

nonzero_exit_errors = true
filesize_metric = false
disable_table_indexes = true
complete_from_path = true
rm_always_trash = false
prompt = "build-string (ansi gb) (pwd) (ansi reset) ' (' (ansi cb) (do -i { git rev-parse --abbrev-ref HEAD } | str trim ) (ansi reset) ')' (char newline) (ansi yb) (ansi reset) '> ' "

startup = [
  "source C:/Users/aminy/nurc.nu",
]

[line_editor]
history_duplicates = "ignoreconsecutive"
completion_type = "circular"
auto_add_history = true
tab_stop = 2

My ~/nurc.nu:

# git functions
def git_commit [message: string] {
  git add ./
  git commit -m $message
}
def git_discard [] {
  git reset --hard
}

def git_amend [message: string] {
  git commit --ammend -m $message
}

def git_rebase [commit: string] {
  git rebase -i $commit
}

def git_log [] {
  git log --oneline
}

def git_last [] {
  git log -1 HEAD --stat
}

def git_find [commit_message: string] {
  git log --pretty=oneline --abbrev-commit --grep=$commit_message
}

def git_clean [] {
	git remote prune origin
	git repack
	git prune-packed
	git reflog expire --expire="24 hour" --all
	git reflog expire --expire-unreachable="24 hour" --all
	git prune --expire="24 hour" -v
	git gc --aggressive --prune="24 hour"
}

def git_submodule_add [rev: string, url: string, folder: string] {
  git submodule add --force -b $rev $url $folder
  git submodule update --init --recursive --force
}

def git_submodule_update [] {
  git submodule update --init --recursive --force
}

def git_submodule_remove [path: string] {
  git config -f .gitmodules --remove-section submodule.$path
  git config -f .git/config --remove-section submodule.$path
  git rm --cached $path
  git add .gitmodules
  git commit -m "Remove submodule in {{$path}}"
  rm -rf $path
  rm -rf .git/modules/$path
}

def git_rm_merged [] {
  git branch --merged | lines | where ($it != "* master" && $it != "* main") | each { git branch -D ($it | str trim) }
}

def git_download [repo: string] {
  git clone --depth 1 --single-branch --branch master $repo
}

def file_size [file] {
  ls $file | get size | into int
}

def sum_file_size [file] {
  ls $file | get size | reduce { $acc + $it } | into int
}

def untargz [file] {
  let folder = ($file | str find-replace ".tar.gz" "")
  mkdir $folder
  tar -xvzf $file -C $folder
}

Expected behavior

Fast startup

Screenshots

No response

Configuration

key value
version 0.37.0
short_commit f9ae8820
commit_hash f9ae882012e87e328adbe8da90d3a37ba8aa0448
commit_date 2021-09-14 19:45:30 +00:00
build_os windows-x86_64
rust_version rustc 1.55.0 (c8dfcfe04 2021-09-06)
rust_channel stable-x86_64-pc-windows-msvc (default)
cargo_version cargo 1.55.0 (32da73ab1 2021-08-23)
pkg_version 0.37.0
build_time 2021-09-14 20:08:37 +00:00
build_rust_channel release
features clipboard-cli, ctrlc, dataframe, default, rustyline, term, trash, uuid, which, zip
installed_plugins binaryview, chart bar, chart line, fetch, from bson, from sqlite, inc, match, post, ps, query json, s3, selector, start, sys, textview, to bson, to sqlite, tree, xpath

Additional context

No response

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 17 (6 by maintainers)

Most upvoted comments

The new plugin system (and new engine) is now in nushell. A part of this is that plugins first have a register step, which reads information about them and puts that info into a central location.

On startup, Nushell no longer scans the directory beside the binary. Instead, it uses this cache of plugin information of previously registered plugins. As a result, startup should be significantly faster.

Closing, but if you still experience slowness on startup with the latest main, please re-open or file a new issue.