-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Fish responsiveness in interactive mode is slow #3479
Comments
This seems really unusual. Do you have anything weird in your configuration, particularly any event handlers? Any "frameworks" - OMF or fisherman or so? Can you test this in another terminal? Is it just when launching a command or when typing? |
Also, are you using NFS or any other filesystem that might be slow? |
Hi @faho, thanks for answering.
Thanks again for the kind response. |
Could you make a screen recording on asciinema.org? Or otherwise? |
The most likely thing is that the prompt is slowing this down - you don't happen to have your $HOME in a hg repository, perchance? This can be tested by redefining the fish_prompt function, like If that's not it, do you have vi-mode enabled? Also a recording (text or gif) of a |
Will try. |
This is a record of fish -d5: https://asciinema.org/a/5xix93qsbkisvokwy4ge4guio |
hg repository: no idea of what's that. Now, redefining fish_prompt makes it faster and responsiveness looks close or equal to normal. Bingo! |
So it appears that the prompt is responsible. I just chose one of the suggested prompts in |
Nice detective work. I wonder if mercurial is like git, which walks all the way up the parent directory hierarchy looking for a repository. |
@ridiculousfish: I don't think it's mercurial, though that can be rather slow. (The main cost is usually just starting it, which is why I've written custom code to determine if you're inside a repo) |
@thegreyshadow: Which prompt did you pick? Can you run |
@faho I chose this one: prompt.prof uploaded after converting it to txt due to github's restrictions |
Also I did this: [eduardo@loli |
Eureka! I've actually seen this one before! 55336 55424 --> hostname -s
196 55873 -> printf "[%s@%s %s%s%s]%s " $USER (hostname -s) (set_color $fish_color_cwd) $pwd (set_color normal) $prompt_symbol
112 61290 > fish_prompt
|
See #2854. |
hostname -s brings the text string "loli" |
|
Does /etc/hostname agree with /etc/hosts on your hostname? Do you have any hostname resolver setup? The data says that
I'm assuming that's not on the same line? |
Sorry. Will try to put it correctly:
Sorry for the inconvenience. |
What does /etc/HOSTNAME say? Apparently, that's the slackware file. |
Output:
|
Okay, I'm not actually sure how slack has this setup, so it'd be better if you ask on a slackware forum (I believe linuxquestions.org does a lot of slackware?). I think we've cleared up why your prompt is slow, so the fish part of this is solved. |
@faho I concur. I even don't need my hostname to be displayed so I will see how I could get rid of it. I will look on how to get rid of the hostname in my fish prompt. |
It probably doesn't do the equivalent of |
@faho just found two things now:
Thanks again! |
@faho I just want to say that I solved my particular problem getting rid of the hostname:
This gives me this prompt:
which is exactly what I wanted in the first place. |
Maybe we should offer a $hostname electric var. |
Fish currently only fetches the hostname for naming the universal var file. And the consensus is we should stop doing that. Also, it's pretty unlikely that any Every "responsiveness" issue I can recall being opened in the past year has involved the prompt. So I'm wondering if perhaps we shouldn't just emit a one time warning if constructing the prompt takes a long time. Say more than 300 ms. |
I think it's certain that we can get the hostname faster on our own than by forking an external process. Also consider that |
Well, in Slackware hostname is provided by net-tools 1.6x. In my particular case, invoking Asciinema link showing the above: https://asciinema.org/a/2al3brwb31migfkkwd6sg1hwx |
Of course we can get the hostname faster by avoiding the overhead of launching an external command. Slow down and re-read what I wrote. That overhead is normally inconsequential. Too, the speedup by avoiding that overhead is completely irrelevant if there is a problem that makes host name resolution slow. |
Why is |
In my system This might hint at a reason for it: http://www.linuxquestions.org/questions/slackware-14/hostname-vs-hostname-s-4175592010/#post5621658 |
@thegreyshadow: What happens when you add another line with just the short name? I.e.
In any case, it's rather weird that |
@faho I did it and there is no difference. |
@thegreyshadow: Can you try the inetutils version of hostname? |
@faho since it's such a low level system utility I would be reluctant to do so. But I'll check it out and see what happens. |
It's really weird that |
tested inetutils-1.9.4 compiled locally Output:
the hostname appears rapidly but then the script (since it's a script, |
@krader1961 I know next to nothing about network utilities (or any systems programming for that matter. I'm just a n00b and a user). You might be right, but the fact remains that this is something that is perceived in fish but not in bash. I don't know how bash implements its |
Bash implements
Then it uses |
This, plus things like |
@krader1961 In net-tools 1.6x |
That deserves a "WTF?" response. I have a hard time believing that's true.
No, because the two are not equivalent. The
That's what fish_prompt.fish and fish_fallback_prompt.fish already do. As do most, but not all, of the sample prompts. I'll make a change to fix the prompts which run For the record the prompt you chose is from share/tools/web_config/sample_prompts/user_host_path.fish and is obviously one of the sample prompts that is doing it the slow way. |
Well, check for yourself at the linuxquestions.org thread I quoted above. Wish I could comment more on the merits or flaws of this but the whole issue is way above my head.
Indeed. Anyway, I didn't need the hostname and thankfully I learned how to get rid of it in the |
From that linuxquestions.org thread:
That's basically what it needs to do to resolve that name. This is probably the result of some misconfiguration. Usually, it should be able to figure it out from /etc/hosts alone. |
Closing since this has been resolved and I've opened a new issue to remind me to fix all the prompts we package with fish. |
@krader1961 Agreed, thanks for the help and patience of all members of the fish-shell in understanding and solving the issue. |
sh -c 'env HOME=$(mktemp -d) fish'
)?fish version installed (
fish --version
):2.3.1
OS/terminal used:
Slackware Linux, 64-bit, -current series
Output of "uname -a":
Linux [hostname] 4.4.23 #1 SMP Fri Sep 30 21:14:07 CDT 2016 x86_64 Intel(R) Core(TM) i7-4510U CPU @ 2.00GHz GenuineIntel GNU/Linux
Terminal: yakuake, using konsolepart5 (KDE Plasma)
Talk about the the issue here.
I like fish and made it the default shell for my user.
The experience so far it's ok but I find it very slow in its responsiveness in interactive use.
Most of the time, response between a typed command and its response is measured in seconds.
Even clearing out the terminal screen by issuing Ctrl-L takes two seconds (!)
This is even despite the fact that I have a reasonably fast CPU (see uname output, above) and 12 GB RAM. In this machine bash flies, but fish does not.
Reproduction steps
(not necessary)
Thanks again for developing fish. I think it's a fantastic product. Hope you guys keep improving it.
The text was updated successfully, but these errors were encountered: