-
Notifications
You must be signed in to change notification settings - Fork 424
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
While the end result is the same, the method of generating the colors slightly changed to avoid calling subshells. It does this in two ways: 1. Don't use a subshell (`$(...)`), instead call a function first, and use the output stored in a variable. 2. Use a cache to prevent calling to `tput` as much as possible. In this case, the cache doesn't do a ton, but in my tests it did give a slight noticeable improvement. This on average got my prompt startup time down from 0.092s to 0.062s. Not this specific funtion time, the whole prompt startup. The addition of 1 on the array indexes is because some shells (ksh, bash) are 0 array indexed, while most (zsh, csh, Bourne) are 1 array indexed, and would then fail on this array with the black color index of 0. Adding 1 doesn't hurt anything on 0 array indexed shells.
- Loading branch information
Showing
1 changed file
with
52 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
d62bf31
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍