agnoster-zsh-theme
agnoster-zsh-theme copied to clipboard
Performance improvements
This PR improves performance, especially when we're not in a git repo, by cutting down the number of forks/execs needed just to render the prompt. It's a particularly noticeable speedup on Cygwin.
While this may improve performance, I don't think this will drastically reduce the number of forks. print
is a zsh builtin and shouldn't cause a fork. Additionally, any call to a zsh function shouldn't cause a fork.
There's also a large chance this adds back the exploit (https://github.com/njhartwell/pw3nage) which was fixed in #33.
The jobstates fix does seem like it might help though.
@belak Hmm, I think you're right about the exploit being re-introduced; I hadn't noticed that when I did this work. But what about the other change (897b31f) to use $jobstates rather than $(jobs | wc) -- that's two forks avoided (one for the subshell, one for wc), and you could take it independently of the other commit.
Unfortunately I don't have merge access to this repo... I'm just fairly familiar with the code.
The first commit looks fine to me though. :)