-
Notifications
You must be signed in to change notification settings - Fork 840
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
Improve alias generation performance #79
Conversation
This is superb, I've been hoping to optimize this but I rarely regenerate aliases so I never bothered. |
do you mind if we drop this commit? I think it increases alias count, hence the load time 35% for no good use case really. |
Sure, no problem. One thing to note though is that this will remove any combinations of kubectl-aliases/.kubectl_aliases Lines 335 to 352 in b2ee5db
|
No that wasn't intended I think. |
e29863f
to
9eb782b
Compare
I've removed the commit in question (f168a28). The new behaviour is that |
This PR proposes the following changes:
combinations
function, allowing for generating aliases with more optional args in reasonable runtime,w
flag to be used in conjunction output format flags likeoyaml
,ojson
andowide
The main motivation for the PR was addressing the performance of the
combinations
function which I've noticed to be prohibitively slow if more args are added. Many of the permutations generated by thecombinations
include incompatible flags which can be filtered out early to make the overall generation run faster.Moreover, this PR adds a few more permutations of the
w
,ojson
,oyaml
andowide
flags. Previously the incompatibility definitions on thew
flag tried to prevent it being used with json, yaml and wide outputs. However, due to the way incompatibilities were evaluated (look-behind check) the script still emitted permutations wherew
was followed byojson
etc, but not the other way around. This PR makes the incompatibility check global (i.e. not only look-behind) and allowsw
to be used with output formats in any order.