ZupIT / ritchie-cli

Ritchie CLI is an open-source tool that allows to create, store and share any kind of automation, executing them through command lines, to run operations or start workflows ⚙️ 🖥 💡
https://docs.ritchiecli.io
Apache License 2.0
561 stars 104 forks source link

Autocomplete taking a long time to start terminal #1066

Open gontijolucas opened 2 years ago

gontijolucas commented 2 years ago

What happened: when ritchie autocomplete is present on my .zshrc file, my 'bash' session takes around 30 seconds to be ready to use.

What you expected to happen: That there is no delay as big as this at the beginning of my Bash session.

How to reproduce it (as minimally and precisely as possible): ritchie autocomplete needs to be in start script. ~/.zshrc

[[ -r /usr/local/bin/rit ]] && rit completion zsh > ~/.rit_completion
source ~/.rit_completion

Anything else we need to know?:

I have benchmarked my bash to find the source of problem, and It seems that the problem occurred in the rit conclusion zsh.

With ritchie autocomplete, start in almost 30 seconds.

~ hyperfine --shell zsh 'source ~/.zshrc'
Benchmark 1: source ~/.zshrc
  Time (mean ± σ):     24.987 s ± 11.152 s    [User: 0.200 s, System: 0.039 s]
  Range (min … max):    0.454 s … 30.219 s    10 runs

Testing ritchie autocomplete command in my .zshrc

~ hyperfine 'rit completion zsh > ~/.rit_completion'
Benchmark 1: rit completion zsh > ~/.rit_completion
  Time (mean ± σ):     24.987 s ± 11.152 s    [User: 0.200 s, System: 0.039 s]
  Range (min … max):    0.454 s … 30.219 s    10 runs

Without ritchie autocomplete, start in 205ms.

~ hyperfine --shell zsh 'source ~/.zshrc'
Benchmark 1: source ~/.zshrc
  Time (mean ± σ):     199.7 ms ±   2.0 ms    [User: 180.8 ms, System: 31.5 ms]
  Range (min … max):   197.6 ms … 205.4 ms    14 runs

Environment: