Spaceship-prompt: Command slow in repository

Created on 5 Sep 2018  ยท  19Comments  ยท  Source: denysdovhan/spaceship-prompt

Current behavior

  1. cd to <repository_path>
  2. try to run git status 3x times
  3. When I finish type, it just show the first command result
  4. Cause in some repository only (Don't know, why)

I validate that the main problem should cause by this theme, since I try to change the new ones, git status will return as expected.

Expected behavior

  1. git status shouldn't take that long time.

Relevant Zsh configuration (.zshrc)

# Your configuration here

p_url="https://github.com/denysdovhan/spaceship-prompt.git"
spaceship_location="${HOME}/.zgen/sorin-ionescu/prezto-master/modules/prompt/external/spaceship"

if ! is_folder_exist "$spaceship_location"; then
    git clone "$spaceship_url" "$spaceship_location" &>/dev/null
    ln -s "${spaceship_location}/spaceship.zsh-theme" ~/.zprezto/modules/prompt/functions/prompt_spaceship_setup
fi

if is_file_exist "${spaceship_location}/spaceship.zsh-theme"; then
    prompt spaceship
fi

SPACESHIP_PROMPT_ORDER=(
    time
    user
    host
    package
    node
    ruby
    xcode
    swift
    golang
    php
    docker
    aws
    conda
    line_sep
    dir
    git
    exec_time
    line_sep
    battery
    exit_code
    char
)

SPACESHIP_RPROMPT_ORDER=(
    jobs
)

SPACESHIP_PROMPT_FIRST_PREFIX_SHOW=true

SPACESHIP_TIME_SHOW=true
SPACESHIP_TIME_FORMAT="%D{%d-%m-%Y %H.%M.%S}"
SPACESHIP_BATTERY_SHOW=always

SPACESHIP_EXIT_CODE_SHOW=true
SPACESHIP_EXEC_TIME_SHOW=true
SPACESHIP_EXEC_TIME_ELAPSED=1

you can get fully .zshrc at https://github.com/kamontat/myzs

Environment

Spaceship version: 3.5.0 (use echo $SPACESHIP_VERSION)
Zsh version: zsh 5.5.1 (x86_64-apple-darwin17.5.0)
Zsh framework: prezto
Zsh plugin manager: zgen
Terminal emulator: iTerm2
Operating system: macOS High Sierra 10.13.6

Screenshot

Provide a screenshot that shows your issue. This is Video upload in Google drive

Google drive

Possible solution


I think, It start slow when I instal NVM but not sure.

question

Most helpful comment

I really enjoy spaceship prompt, but recently do some linux kernel tinkering. It's not usable at all.
Try to clone
https://github.com/torvalds/linux/
then navigate the folders inside.
Getting the prompt back after a single ls takes more than 20 seconds, sadly.

All 19 comments

Could you please upload screenshot directly here or to image hosting services like imgur rather than to Google Drive ?

Do checkout prezto-contrib which makes it easy to install spaceship with prezto.

I already try but not success.

2018-09-06_00-35-22

Excuse us for the trouble, Some of the sections you've enabled like battery and git_status affect performance, We're trying to improve performance of some sections with async rendering (#499).

If possible please try with different combinations of SPACESHIP_PROMPT_ORDER and let us know who is the culprit. Any help to improve prompt is appreciated.

It found that the problem cause by node sections, since I currently install NVM.

Lets leave this open until we improve the relevant section with async rendering.

Ok.

Any update?

This will be mostly resolved with v4.0. Please follow the related issue #491

I really enjoy spaceship prompt, but recently do some linux kernel tinkering. It's not usable at all.
Try to clone
https://github.com/torvalds/linux/
then navigate the folders inside.
Getting the prompt back after a single ls takes more than 20 seconds, sadly.

Try to use any of the available async implementations of spaceship, async makes all the difference in the world ๐Ÿ˜‰

demo

@maximbaz that looks cool! I see there's an open PR, do you know when it will be merged?

In the meanwhile, which async implementation of spaceship do you suggest?

Personally I use my own fork with async implementation, but it seems #697 will be the approach that eventually gets merged, so maybe try that one and use the opportunity to provide feedback if something doesn't work as expected ๐Ÿ˜‰

I know how much OSS maintainers hate "+1" replies, so hopefully I can be excused considering that I've also added a ๐Ÿ‘ to this Issue.

I too am running into this problem, where much time is being spent between commands running spaceship code (at least a few seconds or more). I confirmed this by running set -x and observing the instructions being printed. On my shell, I have NVM lazy loading implemented (customized based on this gist). I added it because NVM was a major culprit to slow shell startup times. I've noticed that spaceship is slower if I have not yet lazy loaded nvm, but runs way faster if I have. Unfortunately, that kind of defeats the purpose of lazy loading NVM.

Unfortunately, I've been forced to turn off spaceship and use a different ZSH theme until this issue is resolved.

@ecbrodie Maybe you might change version manager to asdf. I didn't use NVM for a long time because it so slow even we use lazyload.

@kamontat convincing an entire software development organization to switch dozens of apps and several teams to use ASDF instead of NVM for downloading NodeJS is a non-starter for me. I'd like to see this project add improved support for the still-industry-standard tool for downloading NodeJS.

@maximbaz async PR #697 looks great, the prompt is much faster with git::async!

Unfortunately for some reason a lot of control sequences seem to not work anymore using that branch. For example, typing ctrl-a just prints the char instead of going to the beginning of the line:

~ 
[I] โžœ ^A

Not sure if that's related to that PR. I can send you more debugging information if needed.

Please post the details (and debugging info) in that PR, in this particular case I'd let the author of that PR investigate and fix these issues first ๐Ÿ˜‰ But happy that async fixes the performance issue for you!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

JounQin picture JounQin  ยท  3Comments

xhaythemx picture xhaythemx  ยท  3Comments

jwhipp picture jwhipp  ยท  3Comments

Vvkmnn picture Vvkmnn  ยท  3Comments

ChadTaljaardt picture ChadTaljaardt  ยท  4Comments