←back to thread

457 points benoitg | 1 comments | | HN request time: 0.199s | source
Show context
voidUpdate ◴[] No.44365306[source]
Does the speed of your shell matter? Surely the speed of the programs that you're running through your shell matter more. I've never been let down by how fast bash can tell a program to start running

EDIT: oh, i misunderstood, its just the prompt at the start of your shell... I dont think ive ever been annoyed at how fast that renders either

replies(5): >>44365338 #>>44365366 #>>44365392 #>>44365918 #>>44367891 #
danpalmer ◴[] No.44365366[source]
Some people like to put, for example, their current git branch in the prompt. To get that means at least naively, running a git command on every single line the prompt renders on. Git is fast, but it's easy to add a bunch of these and suddenly your prompt takes 100ms to render. Hit enter a few times and you'll immediately notice lag. For that reason, doing this fast does make a real difference.

Of course the fastest thing is to just not stuff your prompt full of detail.

replies(4): >>44365426 #>>44367421 #>>44367917 #>>44378423 #
blueflow ◴[] No.44365426[source]
If you do not have any subshells or command substitutions in your PS1, then you also save alot of time on platforms like WSL, where forks are expensive.
replies(1): >>44378330 #
1. partdavid ◴[] No.44378330[source]
My earliest background as a shell user was as as system administrator (back in "the day", let's say), and forks are always potentially expensive, and often the reason you're opening a shell session in the first place (to diagnose resource contention or exhaustion, for example). There have been lots of times when one more fork is too much to take. (Which also, yes, makes it "interesting" to figure out what you can run in your shell session, too).