Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Synth shell is a bit slow in Windows WSL #35

Open
vinrepos opened this issue Dec 14, 2023 · 14 comments
Open

Synth shell is a bit slow in Windows WSL #35

vinrepos opened this issue Dec 14, 2023 · 14 comments

Comments

@vinrepos
Copy link

Hi so I've managed to make synth shell look exactly how I wanted but I just found it to be a bit slow. Sometimes it takes like half-a-second to load the output. Is there any way to speed it up? I've also attached a video recording of my terminal.

Awesome-Screen-Recorder-Screenshot.mp4
@andresgongora
Copy link
Owner

andresgongora commented Dec 14, 2023 via email

@vinrepos
Copy link
Author

vinrepos commented Dec 14, 2023

Hey I do have internet connectivity on my host machine and the wsl. And I also tested the commands without the internet. Both times the responses were slow.

And I couldn't find any IP address related lines in the synth shell config files anywhere. Could you let me know where exactly it would be, please?

Thanks
vin

@andresgongora
Copy link
Owner

andresgongora commented Dec 15, 2023 via email

@vinrepos
Copy link
Author

Hi thanks, but I don't have a synth-shell-greeter.config file. Have a look at the screenshot below, please.

image

@andresgongora
Copy link
Owner

andresgongora commented Dec 15, 2023 via email

@vinrepos
Copy link
Author

Yeah I'm using only the synth shell prompt. I just tried uninstalling it and I'm back on the default shell and it is pretty fast.

Anyway, i reckon it's a known issue with WSL. I have tried a few things from a few other relevant threads but hasn't really helped improve the terminal output speed.

@andresgongora
Copy link
Owner

andresgongora commented Dec 15, 2023 via email

@vinrepos
Copy link
Author

Yeah I have tried that too, hasn't worked either. I think WSL sucks haha, I'm gonna go back to using a proper VM. Thanks for your help so far anyway.

@andresgongora
Copy link
Owner

andresgongora commented Dec 15, 2023 via email

@dannykurniawan80
Copy link

Hi @vinrepos, I had the same issue with WSL being slow processing the prompt. Then I found this:

https://yalneb.blogspot.com/2018/01/fancy-bash-promt.html

It seems that the script is much more simpler and doesn't add advanced features like git or python environment, but it suit my purpose. I'm guessing the script is an early version of the synth-shell-prompt.

The only drawback is, it is slightly more difficult to configure, since you need to read the script and find the exact variable to change, and no fancy git feature that I actually love. Good thing is there is no delay at all when displaying the prompt.

@andresgongora
Copy link
Owner

andresgongora commented Aug 4, 2024 via email

@dannykurniawan80
Copy link

dannykurniawan80 commented Aug 5, 2024

Hi @andresgongora, first I disable all extra environments from config file as follows:

format="USER HOST PWD"

But it's still slow, so I try to disable the actual codes from synth-shell-prompt.sh as well:

...
prompt_command_hook()
{
        ## GET PARAMETERS
        ## This might be a bit redundant, but it makes it easier to maintain
        local elements=(${SSP_ELEMENTS[@]})
        local user=$USER
        local host=$HOSTNAME
        local path="$(shortenPath "$PWD" $SSP_MAX_PWD_CHAR $SSP_PWD_TRUNC_SYMBOL)" # bash-tools::shortenPath
        #local git_branch="$(getGitBranch)"
        #local pyenv="$(getPyenv)"
        #local kube="$(getKube)"
        #local tf="$(getTerraform)"
        local clock="$(date +"${SSP_CLOCK_FORMAT}")"
        ## ADAPT DYNAMICALLY ELEMENTS TO BE SHOWN
        ## Check if elements such as GIT and the Python environment should be
        ## shown and adapt the variables as needed. This usually implies removing
        ## the appropriate field from the "elements" array if the user set them
        #if [ -z "$git_branch" ]; then
        #       elements=( ${elements[@]/"GIT"} ) # Remove GIT from elements to be shown
        #fi
        #if [ -z "$pyenv" ]; then
        #       elements=( ${elements[@]/"PYENV"} ) # Remove PYENV from elements to be shown
        #fi
        #if [ -z "$tf" ]; then
        #       elements=( ${elements[@]/"TF"} ) # Remove TF from elements to be shown
        #fi
        #if [ -z "$kube" ]; then
        #       elements=( ${elements[@]/"KUBE"} ) # Remove KUBE from elements to be shown
        #fi
        ...

The delay slightly better, but still there...

@andresgongora
Copy link
Owner

andresgongora commented Aug 5, 2024 via email

@dannykurniawan80
Copy link

@andresgongora, I tried to modify synt-shell-prompt.sh and adding timestamp for execution of each line. Somewhat profiling execution time of each line in the script:

profile.log

here's my modified script:

synt-shell-prompt_debug.tar.gz

When I ran it, seems total time closing to 1.7 seconds (including profiling stuffs I think), but I think we can check how much time spent for each line of the codes from the log.

The configuration still same, I only change the following line in synth-shell-prompt.config:

format="USER HOST PWD"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants